Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Browse by Tags

All Tags » lookahead
Showing page 2 of 2 (19 total posts)
  • Re: return the number before a word

    Hi Mark, try this pattern: \d+(?=\syears?) It works also for "The dog is 1 year old" (the 's' of years is optional).
    Posted to Construction Advice (Forum) by eSquire on May 6, 2007
  • Re: please suggest me the regex for this piece

    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 ...
    Posted to Construction Advice (Forum) by eSquire on May 4, 2007
  • Re: Match-order

    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.
    Posted to Construction Advice (Forum) by eSquire on May 3, 2007
  • Cannot get lookahead and lookbehind to work

    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 ...
    Posted to Construction Advice (Forum) by Major Problem on May 2, 2007
  • Re: graping meta contents like a search bot

    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 = ...
    Posted to Construction Advice (Forum) by eSquire on April 24, 2007
  • Re: regex addition

    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 ...
    Posted to Construction Advice (Forum) by eSquire on April 24, 2007
  • Re: My regex matches strings that are too long :-(

    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.
    Posted to Construction Advice (Forum) by eSquire on April 24, 2007
  • Look ahead and Look behind

    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 ...
    Posted to Construction Advice (Forum) by emarket78 on March 31, 2007
  • Re: Detect content of tags

    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 
    Posted to Construction Advice (Forum) by Brendan on March 7, 2007