Regex: Match 'Hello' but not 'Hello world'
Hi all,
Is it possible to 'look ahead' with regex? For example, say I want to match 'hello': e.g. >I want to say hello to you - match but not when it was followed by a specific word, say 'world': e.g. >hello, good morning - match >My output is hello world - don't match >hello and goodbye - match My hazy recollection is that this is not possible to look ahead with a single line of regex - do I remember correctly? Thanks in advance... |
Ah, solved it myself:
hello(?! world) New regex (for me) in Perl 5... |
All times are GMT -5. The time now is 06:56 AM. |