Regular expressions (often shortened to "regex") are a declarative language used for pattern matching within strings. Please also include a tag specifying the programming language or tool you are using.
1
vote
0answers
12 views
Regex to find overlapping, randomly-named tags — non-greedy backreference
I have a generated HTML string that may contain overlapping tags, and trying to find them to make the HTML valid. The string is in the format (ex: overlapping tags, then nested tags):
<tag_1> ...
0
votes
3answers
21 views
Count the number of quotes in a string using regex
I can't seem to get this to work it keeps returning null. I need a very simple way to get a count of the number of quotes in a string.
var wtf = '"""'
var count = wtf.match(/"/g);
alert(count);
...
0
votes
1answer
18 views
Perl simple regex is boggling my mind
I have a variable $message that when i print produces.
Date: Wed Jun 26 18:15:11
some message test
[tug=123
[rug testing one]
the boy fell on the rug
#update]
the text may alter, but ...
1
vote
2answers
29 views
php preg_replace phone numbers
I want to replace the given phone numbers in an html string, such as
<a>click here now! (123) -456-789</a>
I think that the best way to approach it would be to find all the different ...
1
vote
3answers
34 views
Regex: How to replace a symbol between Non-English String but not English one
I have a string where it contains English and Non-English characters, and both of them contains the underscore symbol _ between them.
I would like to remove the underscore from the Non-English string ...
2
votes
1answer
29 views
python RE: Non greedy matches, repitition and grouping
I am trying to match repeated line patterns using python RE
input_string:
start_of_line: x
line 1
line 2
start_of_line: y
line 1
line 2
line 3
start_of_line: z
line 1
Basically I want to ...
0
votes
3answers
41 views
regex in javascript, match only A-z and _?
Hello this is the first time I've worked with regex before and I'm attempting to take a variable entered by the user and see if it is limited to A-Z, a-z, 0-9, and _
this is the code I have so far:
...
0
votes
1answer
19 views
How to store regex match in a variable to use with Search/Replace in Notepad++
I need to capture a word using a pattern and store somewhere to use in replace operation:
For instance I have this text
ab iiids
as sasas
md aisjaij
as asijasija
I am able to capture everething ...
1
vote
2answers
76 views
Python and Regular Expressions
Good Day all,
I posted something similar earlier, so if you're running across this again, I apologize. This time around I'll be more specific and give you direct examples and portray exactly what I ...
0
votes
1answer
49 views
Regex with StreamReader
i have interesting problem with streamreader.
my code:
string file, text;
MatchCollection mcol;
private void btnGozat_Click(object sender, EventArgs e)
{
file = ...
3
votes
1answer
42 views
Prevent empty elements in list when using an OR statement with regex in Python
I'm compiling prices from a website using regex.
PriceFinder = re.compile('(?<=\n\s\<b>\$)(\d*\.\d{2})(?=\<\/)|(?<=\"FF0000"><b>\$)(\d*\.\d{2})(?=\<\/)')
Price = ...
-1
votes
0answers
18 views
Regular expression for removing Google Analitycs script tag
I'm using this regular expression:
/<script[\s\S]+(_gaq)[\s\S]+<\/script>/
And it's working on the online tool for function online - but when I ran it locally - it matches everything - ...
0
votes
0answers
20 views
Searching in xslt using Perl regex
I currently have a search application written in perl that uses a couple xslt style sheets to convert a certain file type to an HTML document with the results. Right now, the application takes the ...
1
vote
3answers
35 views
Pattern java Finding out what part of OR matched
I have the following pattern:
Pattern TAG = Pattern.compile("(<[\\w]+]>)|(</[\\w]+]>)");
Please note the | in the pattern.
And I have a method that does some processing with this ...
0
votes
0answers
8 views
re.finditer() skips unicode into selection
I am using the following Highlighter class for Spell Checking to work on my QTextEdit.
class Highlighter(QSyntaxHighlighter):
pattern = ur'\w+'
def __init__(self, *args):
...