Help for a Regex newcomer
Posted: Wed Aug 29, 2012 4:38 pm
Hi:
I have a question that I am sure is simple for you (but hard for me — I am new to regex).
I have a query that matches all bracketed text in a paragraph including the brackets (which I subsequently replace).
\(.*?\)
However, I would like to match only bracketed text that includes the numbers on the range 1900 through 2100.
That is, I would like to match: (Simon 1957) or (Simon 1957, Johnson 1927), or (Simon 1957 Johnson)
but not match: (Simon 1222) or (Simon) or (Simon Johnson).
Does anyone have any suggestions? Your help would be much appreciated.
Thanks very much.
I have a question that I am sure is simple for you (but hard for me — I am new to regex).
I have a query that matches all bracketed text in a paragraph including the brackets (which I subsequently replace).
\(.*?\)
However, I would like to match only bracketed text that includes the numbers on the range 1900 through 2100.
That is, I would like to match: (Simon 1957) or (Simon 1957, Johnson 1927), or (Simon 1957 Johnson)
but not match: (Simon 1222) or (Simon) or (Simon Johnson).
Does anyone have any suggestions? Your help would be much appreciated.
Thanks very much.