Hi,
I am trying to write a regex to match pairs of cards (AA, KK, QQ ... 22) and I have the regex ([AKQJT2-9])\1. The problem I have is that this regex will match AA as well as AAbc etc. Is there a way to write the regex such that I can specify I want to match ([AKQJT2-9])\1 and only that (i.e. no more characters after).
Thanks
...
Hi,
I do the validation through configuration files.
But, RegexValidator does not work properly.
This Validator not disciplined even to unknown regular expression!!
For example, if I add a RegexValidator to field with regular expression '\d', It allow also Letters. it validate only first Character.
Also, if I set more than 15 Characte...
I have a test list that I am trying to capture data from using a regex.
Here is a sample of the text format:
(1) this is a sample string /(2) something strange /(3) another bit of text /(4) the last one/ something!/
I have a Regex that currently captures this correctly, but I am having some difficulty with making it work under outlie...
Hi,
I want to match against Strings such as AhKs & AdKs (i.e. two cards Ah = Ace of Hearts). I want to match two off-suit cards with a regex, what I currently have is "^[AKQJT2-9][hscd]{2}$", but this could match hands such as AhKh (suited) and AhAh. Is there a way to possibly use backreferences to say the second [hscd] cannot be the sa...
I need to extract data from a source that presents it in one of two ways. The data could be formatted like this:
Francis (Lab) 18,077 (60.05%); Waller (LD) 4,140 (13.75%); Evans (PC) 3,545 (11.78%); Rees-Mogg (C) 3,064 (10.18%); Wright (Veritas) 768 (2.55%); La Vey (Green) 510 (1.69%)
Or like this:
Lab 8,994 (33.00%); C 7,924 (29.07%...
Sipdroid on Android has a search & replace method, that uses regex.
I'm trying to use it to make sure all outgoing calls has a country code in the format 00XX
I also want it to put 0045 in front of the number, if no country code is present.
The first one, I have solved, but I can't figure out how to do the second thing.
Search:
\A(((...
I'm trying to make a PHP regex to extract functions from php source code. Until now i used a recursive regex to extract everything between {} but then it also matches stuff like if statements. When i use something like:
preg_match_all("/(function .(.))({([^{}]+|(?R))*})/",$this->data,$matches2);
It doesn't work when there is more than 1...
I have to create a regular expression for some path conversion.
Example for path are
//name:value /name:value // name:value
/name:value /name:value
/name:value//name:value
thing is how to check for // or / at the start or middle of the string and how can i specify that name can contain any of this a-zA-Z and _
Path also contains whit...
Ok I am trying to get the users First Name
the form gets their name perfectly fine and posts it into a variable.
Now I am trying to do error checking
else if(!preg_match("/^[\w-]+$/", $firstNameSignup)) {
$firstNameSignupError = "Your first name cannot contain numbers or symbols, you entered " . $firstNameSignup;
$firstN...
I'm trying to grep through a bunch of files in nested subdirectories to look for regular expression matches; my regex requires negative lookbehind.
Perl has negative lookbehind, but as far as I can tell GNU grep doesn't support negative lookbehinds.
What's the easiest way to get an equivalent to GNU grep that supports negative lookbehi...
I have a text file that contains a number of the following:
<ID>
<Time 1> --> <Time 2>
<Quote (potentially multiple line>
<New Line Separator>
<ID>
<Time 1> --> <Time 2>
<Quote (potentially multiple line>
<New Line Separator>
<ID>
<Time 1> --> <Time 2>
<Quote (potentially multiple line>
<New Line Separator>
I have a very simple rege...
I need to check the web address, using regular expression.
if user type url as
www.test.com
http://www.test.com
https://www.test.com
i have a regular expression like
/^(http\:\/\/[a-zA-Z0-9_-]+(?:.[a-zA-Z0-9_-]+)*.[a-zA-Z]{2,4}(?:\/[a-zA-Z0-9_]+)*(?:\/[a-zA-Z0-9_]+.[a-zA-Z]{2,4}(?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?)?(?:\&[a-zA-Z0-9_...
Ok, so I tried searching around first but I didn't exactly know how to word this question or a search phrase. Let me explain.
I have data that looks like this:
<!-- data:start -->
<!-- 0:start -->
<!-- 0:start -->0,9<!-- 0:stop -->
<!-- 1:start -->0,0<!-- 1:stop -->
<!-- 2:start -->9,0<!-- 2:stop -->
...
I'm trying to find every instance of @username in comment text and replace it with a link. Here's my PHP so far:
$comment = preg_replace('/@(.+?)\s/', '<a href="/users/${1}/">@${1}</a> ', $comment);
The only problem is the regex is dependent upon there being whitespace after the @username reference. Can anyone help me tweak this so it...
I want to use a variable in a regex, like this:
variables = ['variableA','variableB']
for i in range(len(variables)):
regex = r"'('+variables[i]+')[:|=|\(](-?\d+(?:\.\d+)?)(?:\))?'"
pattern_variable = re.compile(regex)
match = re.search(pattern_variable, line)
The problem is that python adds an extra backslash character f...
Hey Guys,
i'm not very firm with preg_replace - in other Words i do not really understand - so i hope you can help me.
I have a string in a Text like this one: [demo category=1] and want to replace with the Content of Category (id=1) e.g. "This is the Content of my first Category"
This is my startpoint Pattern - that's all i have:
'/...
I have a list of variables:
variables = ['VariableA', 'VariableB','VariableC']
which I'm going to search for, line by line
ifile = open("temp.txt",'r')
d = {}
match = zeros(len(variables))
for line in ifile:
emptyCells=0
for i in range(len(variables)):
regex = r'('+variables[i]+r')[:|=|\(](-?\d+(?:\.\d+)?)(?:\))?'
...
I'm looking for an online utility that will prettify and add explanatory comments to a regular expression. Does one exist?
...
Lets try again. I need to get VALUE directly behind BLAH_X. BLAH_X is EVERYWHERE however i have known KEYS. So i would like to use regex to find the VALUE directly behind BLAH_X. The way i am doing this now matches DUMMY which is directly before blahx instead of the value which is directly behind the blahx behind the known KEY.
I hav...
I'm trying to read a file of regexes, looping over them and filtering them out of another file. I'm so close, but I'm having issues with my $regex var substitution I believe.
while read regex
do
awk -vRS= '!/$regex/' ORS="\n\n" $tempOne > $tempTwo
mv $tempTwo $tempOne
done < $filterFile
$tempOne and $tempTwo are temporary files. ...