prometheuzz wrote:Note that there is not need to escape the '<' and '>':
Just habit, though I think a good one. I got tired of having one character need to be escaped and having to go back and idit, so I just escape every non-alphanumeric character that I am not using as a meta-character. There are so many common characters used meta-characters that I think being explicit is clearer.
prometheuzz wrote:Note that there is not need to escape the '<' and '>':
Just habit, though I think a good one.
It makes your regex overly verbose, IMO.
arborint wrote:I got tired of having one character need to be escaped and having to go back and idit, so I just escape every non-alphanumeric character that I am not using as a meta-character. There are so many common characters used meta-characters that I think being explicit is clearer.
Perhaps for someone not familiar with regex. But someone who is familiar with them, will most likely disagree with you (as I do).
prometheuzz wrote:Perhaps for someone not familiar with regex. But someone who is familiar with them, will most likely disagree with you (as I do).
Well I am someone familiar with regex, so all we know is that half of people familiar with regex disagree. Unless you are authorized to speak for all regex users (I hadn't been informed).
prometheuzz wrote:Perhaps for someone not familiar with regex. But someone who is familiar with them, will most likely disagree with you (as I do).
Well I am someone familiar with regex, so all we know is that half of people familiar with regex disagree. Unless you are authorized to speak for all regex users (I hadn't been informed).
Hence the "most likely" in my response.
Anyway, perhaps I meant to say "more familiar".
; )
Really, I don't mean to say this to put you down or something, but if you truly escape all characters other than alpha-numerics, I really think you're over doing it. Especially inside a character class where most regex-meta characters don't have any special meaning to begin with.
prometheuzz wrote:Really, I don't mean to say this to put you down or something, but if you truly escape all characters other than alpha-numerics, I really think you're over doing it. Especially inside a character class where most regex-meta characters don't have any special meaning to begin with.
Yeah, for regex pros it is over doing it -- even annoying to some. My comment was meant for the original poster because I have found that escaping symbols that you want to be literals reduces problems. It has been my experience that there are really very few people who truly understand regular expressions. Most of the questions here are from people who found an example somewhere and when they try to change it it explodes. So I thing the consistency helps.