|
|
Browse by Tags
All Tags » lookahead
Showing page 1 of 2 (15 total posts)
-
Hello, I am using C# in Visual Studio 2008. I have a text file of the entire Bible that I am wanting to either put into a database or write to an XML document. The format of the text is as follows with comments in C# single line comment style to the right of the actual text (example: Genesis //book ...
-
Hello there, I am using PHP, preg_match to pull out of various Auction titles for video games, the video game platform of those games. I have a list of valid ones and trying to match back to them. However as this is completely user entered data there is a enormous amount of variety in the titles, which leads to some interesting ...
-
mycotics,
may I kindly point out to you post number 29450 in the thread I mentioned?
if (preg_match('/^(?=.*bill)(?=.*bob)/', $string)) {
echo "Oh, look! Bill and Bob are finally here! Let's have a party!";
}
will do what you want.
-
docdawson:
^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*){n,20}$
Doesn't this just match n to 20 e-mail addresses? I understand carlosaml wants addresses with no more than 20 characters.
The shortest possible address that will match the pattern above has 5 characters (a@b.c).
To check for 5 to 20 characters one would have to use a ...
-
Try something along the lines of
^(?!something).*$
Edit:
Lyndar was first. Don't forget to escape the user supplied input string. Pattern.quote(String s) will put start and end of line assertions around the string though.
-
Just use something like:
^From:[^<]+<(?!user1@example\.com)(?!user2@example\.org)(?!user3@example\.net).*?^X-Spam-Level:\s*(\S*)
with singleline (s) and multiline (m) modifiers (so the dot matches newlines and ^ matches the beginning of each line).
-
Hi Mark,
try this pattern:
\d+(?=\syears?)
It works also for "The dog is 1 year old" (the 's' of years is optional).
-
This pattern might do what you need.
(?ms)(?<=^(TO|INFO)\s).*?(?=\s+^(?:INFO|GR)\s)
It will only work reliably if there are no two other lines starting with TO, INFO or GR in the message body, i.e. after the first GR.
It will return one or two matches, depending on the presence of the INFO part. You will have to split those ...
-
You may achieve what you want using lookahead (provided your regex dialect understands it):
^(?=.*abc)(?=.*xyz)
will match if both words are found. You won't have capturing groups with the found words though.
-
Hello,
I wonder if you can help me, this is driving me crazy!
I have a large text file and I want to find a term in it.
But... I only want the regex to be successful if this term is NOT encompassed by square brackets.
e.g. this is the search term: sp_W_rev_CreditClient_RMAItems
I do not want this to be ...
1
|
|
|