Hi all,
I need to add a space in front of a colon : in hundreds of HTMLs, but I don't want to corrupt the links and tags that include a colon, therefore I created a list of keywords in front which the space can't be inserted.
size
family
language
align
http
ftp ....
I was thinking of an RegExp :
Search for: NOT(size|family|language|align|http|ftp):
Replace: \1 :
But I don't know how to insert "NOT" in the list of keywords
thank you
Regexp for adding a space
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Re: Regexp for adding a space
You can't! Unfortunately, you can't search for text that doesn't match an arbitrary regular expression immediately preceding text that does match some other regular expression. The Boost regex library, which is what WildEdit uses, doesn't implement "look-behind assertions". (They are essentially difficult; even Perl's implementation is limited.)
But you can change the colons you want unchanged into something else that doesn't occur elsewhere in the text:
Then recover the other colons:
But you can change the colons you want unchanged into something else that doesn't occur elsewhere in the text:
Then insert a space in front of each colon that remains:Change
(size|family|language|align|http|ftp):
to
$1¤
(Use a space where I've put an underscore.)Change
:
to
_:
Then recover the other colons:
Change
¤
to
: