|
|
Browse by Tags
All Tags » lookahead
Showing page 2 of 2 (19 total posts)
-
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 ...
-
Sorry for committing thread necromancy, but I had some time on my hands and this post had no answer .
My idea of a regex for this problem looks like this:
(?is)<meta\s[^>]*\bcontent\s*=\s*(['"])?((?(1)(?!\1).*?|[^\s>]*))(?(1)\1)
In PHP you would do something like:
$pattern = ...
-
Just stumbling upon your (dated) post here. I hope you've found a solution in the meantime.
The problem is that "!@#$%()" are not part of the word character class (\w) and your lookahead parts of the pattern will have problems matching those special chars. Also, you'll need to extend the matching part to include the special ...
-
I sadly do not know Python, but if it's regular expressions are anywhere near those of my knowledge, just try adding a $-sign in the pattern after .autodbbackup. $ asserts the end of a string.
-
I've been trying to match the pattern below for about a week and
can't seem to get it right. I need to match a specific string that is
not hyper-linked or enclosed in brackets.I'm sure the code below won't
match what i need. It's simply to illustrate what i'm aiming to
accomplish:
[^\{] word here[^\} ]
Any ...
-
Ok, so you will not be using groups. In that case you can use lookahead and lookbehind with this regular expression.
(?<=((<[^>]*>)[^<>/]*))(padding)(?=([^<>/]*(</[^>]*>)))
It will let you replace the word specified in the middle.
Brendan
2
|
|
|