How to place tags around a number

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

How to place tags around a number

Postby crunchycrunch » Tue Feb 01, 2005 6:03 pm

Hi,

If someone could help me with this RE, I'd really appreciate it.

I have a bunch of chemical symbols, e.g. H2O, and I want to subscript their numbers, e.g. H<sub>2</sub>O using search and replace.

The problem is how to reference the number (in this example, 2) in the replace field. If it were always a 2, that would be easy. But it could be any number.


Thanks in advance.
User avatar
crunchycrunch
Newbie
 
Posts: 2
Joined: Tue Feb 01, 2005 12:00 am

Re: How to place tags around a number

Postby palou » Wed Feb 02, 2005 2:03 am

You can use regular expression to do that (check regular expression
in the replace dialog). This one could be fine (UltraEdit style):

"^([0-9]+^)"

replace with:

"<sub>^1</sub>"

That it's.

Regards,
Alain
User avatar
palou
Basic User
Basic User
 
Posts: 46
Joined: Fri Dec 17, 2004 12:00 am
Location: Geneva / Switzerland

Re: How to place tags around a number

Postby crunchycrunch » Wed Feb 02, 2005 12:54 pm

Ah ha! Thanks, Palou!
User avatar
crunchycrunch
Newbie
 
Posts: 2
Joined: Tue Feb 01, 2005 12:00 am


Return to Find/Replace/Regular Expressions