
November 3rd, 2008, 08:51 AM
|
|
|
|
RegEx hell - help appreciated
Hi all
I'm struggling with a regular expression. I need to match:
1) The name of a place
2) Then any of [.,: -]
3) Then either nothing or a word that is NOT one of the following three words: oblast, region, krai.
So for example it would match:
"Investment into Chelyabinsk is up on 2007"
"...factory in Chelyabinsk."
But not...
"Investment into Chelyabinsk oblast is up on 2007"
"...factory in Chelyabinsk oblast."
I've looked through lots of guides and found all sorts of info on exceptions (^) and alternatives (|) but can't seem to nail it.
Thanks in advance.
|