Delete Special Characters (*) if the sequential count is >1

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

Delete Special Characters (*) if the sequential count is >1

Postby lenchemegr » Tue Apr 04, 2006 4:16 pm

Has anyone needed to delete consecutive instances (varying throughout the file) of a special character (*) via a macro. Help.
User avatar
lenchemegr
Newbie
 
Posts: 1
Joined: Mon Apr 03, 2006 11:00 pm

Re: Delete Special Characters (*) if the sequential count is >1

Postby Mofi » Wed Apr 05, 2006 1:36 pm

If I have understood your question correct use following regular expression in UltraEdit style to replace for example **** by a single *.

Find What: ^*^*+
Replace With: ^*

The ^ is described in the help about regular expressions in UltraEdit style with: Overrides the following regular expression character

See also Configuration - Searching - Special character used in Find/Replace strings (normally ^).

In Unix style the \ has the same special meaning as the ^ for UltraEdit style. So in Unix style the appropriate replace is:

Find What: \*\*+
Replace With: \*
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4056
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Delete Special Characters (*) if the sequential count is >1

Postby TomTinsley » Wed Apr 05, 2006 2:18 pm

In normal RegEx you would use

\*{1,}

to specify more than 1 instance of the * character.
User avatar
TomTinsley
Basic User
Basic User
 
Posts: 11
Joined: Wed Feb 16, 2005 12:00 am
Location: South Carolina

Re: Delete Special Characters (*) if the sequential count is >1

Postby TomTinsley » Wed Apr 05, 2006 2:19 pm

In normal RegEx you would use

\*{1,6}

to specify more than 1 and less than 6 instance of the * character.
User avatar
TomTinsley
Basic User
Basic User
 
Posts: 11
Joined: Wed Feb 16, 2005 12:00 am
Location: South Carolina


Return to Find/Replace/Regular Expressions