Need help with regular expression


I am trying to ignore all the text after agent_ for the following text:

<label for="agent_ef26d602d79d453fab5rgf6ae3c1b301_LangPref_0">&nbsp;English</label>

What am I doing wrong in the following:


Please help!

You mean, you want to ignore just “ef26d602d79d453fab5rgf6ae3c1b301_LangPref_0” this part.

Yes because that is a random number that I dont really care.

You can simply do a regular expression everything between the double quotes and do a put the “agent_” part back in place.

sorry I am still new to this. Do I do this? I am not sure how I can replace.


You need to show your project so we know what the context is.
If you are talking about straight string. Here is the replace( )

If you are talking about a <label> element. You need to use DOM to get to that agent string.