i cant do it.
here is the string pattern:
<meta NAME="Description" CONTENT="horse racing books thoroughbred trainer">
the string varies after "CONTENT="
i want to delete the entire meta description content entry, replacing it with nothing, across multiple pages, problem being the varying text after the content= part.
Thanks in advance.
Regular Expression problems
Moderators: AmigoJack, bbadmin, helios, MudGuard
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
So you want content equal to nothing or the whole line deleted?
Using POSIX reg exp syntax
Search for
(<meta NAME="Description" CONTENT=").*
If you wish to clear out the content but keep the line, replace with this
\1" />
Otherwise, if you want to remove the line, replace it with nothing.
Using POSIX reg exp syntax
Search for
(<meta NAME="Description" CONTENT=").*
If you wish to clear out the content but keep the line, replace with this
\1" />
Otherwise, if you want to remove the line, replace it with nothing.
I choose to fight with a sack of angry cats.
-
just_learning
- Posts: 3
- Joined: Tue Jan 06, 2004 5:35 pm
doesnt seem to work right
I opened the files, went to |Search|Replace and then in the "find what" dialog i pasted this:
(<meta NAME="Description" CONTENT=").*
And I continued following instruction, replacing with nothing, etc, and in the "conditions" i checked the "Regular Expression" box, then clicked the "replace all" box. It fails. Can somebody try it out and please tell me how to delete the meta description line from 75 or so html files by using the replace function in textpad and regular expressions, please? Thank you. I just cant get it to work right.
(<meta NAME="Description" CONTENT=").*
And I continued following instruction, replacing with nothing, etc, and in the "conditions" i checked the "Regular Expression" box, then clicked the "replace all" box. It fails. Can somebody try it out and please tell me how to delete the meta description line from 75 or so html files by using the replace function in textpad and regular expressions, please? Thank you. I just cant get it to work right.
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
All of the Regex explanations from talleyrand work perfectly.
Are you sure you have POSIX turned on? From the Main Menu, do this:
Configure, Preferences, Editor, Use POSIX check mark=YES, Apply, and OK.
OR without POSIX use his expression with the following modification:
\(<meta NAME="Description" CONTENT="\).*
Note: if doing a cut and paste from here to TextPad, be sure to strip out any trailing spaces after the pasting.
=============================
One other thought. This is your original example:
Are you sure you have POSIX turned on? From the Main Menu, do this:
Configure, Preferences, Editor, Use POSIX check mark=YES, Apply, and OK.
OR without POSIX use his expression with the following modification:
\(<meta NAME="Description" CONTENT="\).*
Note: if doing a cut and paste from here to TextPad, be sure to strip out any trailing spaces after the pasting.
=============================
One other thought. This is your original example:
Is there a real break in the line after "books", or does it just look that way because of the forum widths? There can be some issues on HTML pages because of "hidden" \n codes. Do the lines that are on the same line work OK with the Regex, and only the lines that "wrap" have a problem? It sounds like this may not be the issue and you are just struggling with the basic Search/Replace with Regex function. But I thought I should mention it.<meta NAME="Description" CONTENT="horse racing books
thoroughbred trainer">
Hope this was helpful.............good luck,
Bob
Bob
-
just_learning
- Posts: 3
- Joined: Tue Jan 06, 2004 5:35 pm
Thank you Bob Hansen and Talleyrand
Well, I didn't follow the instructions careful enough. Yes, I did not have the Posix checked. I figured i was doing something wrong. Thank both of you........I did try very hard though, before "reasking".