regular expressions and back references within [] lists
It seems like a simple problem at first.
Let's start with an example: using the data set Code:
war I can match wee and woo with this expression: Code:
"^[a-z]([a-z])\1$" The expression: Code:
"^[a-z]([a-z])[\1]$" The reason this is a problem is that I thought that I would be able to write an expression like this: Code:
"^[a-z]([a-z])[^\1]$" I've been trying to think back to my CS classes to remember if it's even possible for REs to do this sort of thing. |
The usual reference is [^], but in this case will not work, so is easier to use an work around, like in egrep use the option -v to reverse the result of this expression...
|
All times are GMT -5. The time now is 01:02 AM. |