peach5
1
Hi,
I am trying to ignore all the text after agent_ for the following text:
<label for="agent_ef26d602d79d453fab5rgf6ae3c1b301_LangPref_0"> English</label>
What am I doing wrong in the following:
<label[^>]*for="agent_[^>]*">
Please help!
Peach
Cowwy
2
You mean, you want to ignore just “ef26d602d79d453fab5rgf6ae3c1b301_LangPref_0” this part.
peach5
3
Yes because that is a random number that I dont really care.
Cowwy
4
You can simply do a regular expression everything between the double quotes and do a replace.to put the “agent_” part back in place.
peach5
5
sorry I am still new to this. Do I do this? I am not sure how I can replace.
<label[^>]*for=“agent_[*0-9a-zA-Z]”>
Cowwy
6
You need to show your project so we know what the context is.
If you are talking about straight string. Here is the replace( )
https://www.w3schools.com/jsref/jsref_replace.asp
If you are talking about a <label> element. You need to use DOM to get to that agent string.