using a string instead of a char to deliminate
Posted: Mon Aug 20, 2007 10:08 pm
I've used regexp's for a while and have come to think I'm pretty good with them.
Though there was a problem I came across a while ago that I managed how to figure out another way that worked well. But I never was able to find an answer to the first way I tried to solve it. I just found this forum so I figured I'd ask here.
I wanted to be able to use this: [^_]* (where _ is any character)
with a string (where _ is a string) instead of just characters. I tried grouping and couldn't get it to work with a variety of different combinations of structures such as look ahead.
This is my goal:
[^(?:hi)]* so it continues until it reaches "hi" not just "h" or "i".
Maybe [^[[h]{1}{1}]{2}] ?
It would be nice to be able to use it for any string.
It's easy enough to search for a word, but to use a word as a deliminator I can't figure out.
Though there was a problem I came across a while ago that I managed how to figure out another way that worked well. But I never was able to find an answer to the first way I tried to solve it. I just found this forum so I figured I'd ask here.
I wanted to be able to use this: [^_]* (where _ is any character)
with a string (where _ is a string) instead of just characters. I tried grouping and couldn't get it to work with a variety of different combinations of structures such as look ahead.
This is my goal:
[^(?:hi)]* so it continues until it reaches "hi" not just "h" or "i".
Maybe [^[[h]{1}{1}]{2}] ?
It would be nice to be able to use it for any string.
It's easy enough to search for a word, but to use a word as a deliminator I can't figure out.