Problem with [. -]

Find, replace, find in files, replace in files, regular expressions

Problem with [. -]

Postby seanr » Wed Jul 14, 2004 9:33 am

Any idea why using [. -] on 65040HW.1654B yields HWB instead of 65040HW1654B? The way the help file is written that regexp I used should strip out any period space or dash, but it's removing everything except the letters. That doesn't make any sense to me at all.
User avatar
seanr
Newbie
 
Posts: 2
Joined: Tue Jul 13, 2004 11:00 pm

Re: Problem with [. -]

Postby TimL » Wed Jul 14, 2004 11:05 am

I believe your problem is that its attempting to interpret the - (dash) character in your square brackets as a range.

For example, [a-z] specifies a range of lowercase characters.

If you use [. ^-] (placing a caret prior to the dash) it appears to work for the UltraEdit regular expression engine.

Hope that helps,
-- Tim
User avatar
TimL
Newbie
 
Posts: 1
Joined: Tue Jul 13, 2004 11:00 pm

Re: Problem with [. -]

Postby seanr » Wed Jul 14, 2004 12:09 pm

AHA! Thanks!!!
User avatar
seanr
Newbie
 
Posts: 2
Joined: Tue Jul 13, 2004 11:00 pm

Re: Problem with [. -]

Postby DJMaze » Wed Jul 14, 2004 4:07 pm

A backward slash should also work [. \-] for the Unix regular expression engine or something like [0-9A-Z]-[0-9A-Z]
User avatar
DJMaze
Newbie
 
Posts: 2
Joined: Sun Jun 27, 2004 11:00 pm
Location: Netherlands


Return to Find/Replace/Regular Expressions