Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and Replace ID's

Status
Not open for further replies.

grtfercho

Programmer
Apr 11, 2003
424
US
I "inherit" a lot of pages where the ID's for all input elements have the format
id="some_name"
or
id="some_option_3"

what I need is something fast and simple that will get rid of all the "_" and clean my code to something like

id="somename"
id="someoption3"

I've been using the Search and Replace in different ways but so far the best I could do is using regular expressions get the instances in the results page of every place where ID is named in that way.

Now as for changing the ID to the second format I haven't found anything yet.

Any ideas?

grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
 
?

grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
 
Just a quick question, why do you need to "clean" up your code when "_" is a valid character?

Other than that its a long job of using Find for "_" then using replace to remove it from each page>instance individually.

Cheech

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
I was using hidden fields that control the validation process and the way to do it was through the ID of those hidden fields.
An ID like ptZIP_nameOfTxtBox would mean I need a ZIP code in the txt box with the ID "nameOfTxtBox" the "_" was being used to identify the control part (the zip, it may be a Phone, date,number etc.) and the target element. With id's having the "_" present the function just went crazy and didn't work. ie(ptZIP_some_option_3)

I did solve the problem using a double underscore for the control part, now the ID's for those hidden elements look like.
ptZIP__my_option_3



grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top