Non-greedy delete tag
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Non-greedy delete tag
Hello,
This should be simple, but is beyond me:
I need to eliminate the tag:
<span class="mozp"></span>
surrounding anything:
<span class="mozp">Tath�gata single word or even paragraph with <br /></span>
Any help much appreciated.
I did a search and there is mention that this is not possible in TextPad, but is possible in Wild-edit which I also have.
This should be simple, but is beyond me:
I need to eliminate the tag:
<span class="mozp"></span>
surrounding anything:
<span class="mozp">Tath�gata single word or even paragraph with <br /></span>
Any help much appreciated.
I did a search and there is mention that this is not possible in TextPad, but is possible in Wild-edit which I also have.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Thanks Ben! Yes I wish to eliminate the tag and preserve the contents and it is possible the tag could extend over more than one line.
I'll give this a shot later and get back one way or the other.
You are a real asset to Helios! So many years you have devoted to helping people on this board!
I'll give this a shot later and get back one way or the other.
You are a real asset to Helios! So many years you have devoted to helping people on this board!
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Hello Ben,
I see I must be more specific as to what I need.
This is the tag I need to delete:
<span class="mozp"> xxx </span>
keeping the element xxx.
your </?span\b[^>]*>
captures all span tags which goes too far.
I see I must be more specific as to what I need.
This is the tag I need to delete:
<span class="mozp"> xxx </span>
keeping the element xxx.
your </?span\b[^>]*>
captures all span tags which goes too far.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
<span class="mozp"> xxx </span>
is an element, not a tag.
xxx
is content, not an element.
If I search using the regex
</?span\b[^>]*>
in the element
<span class="mozp"> xxx </span>
and replace each match with nothing, what remains is the content
xxx
(with a space at each end).
If that is not the result you want please explain what is.
is an element, not a tag.
xxx
is content, not an element.
If I search using the regex
</?span\b[^>]*>
in the element
<span class="mozp"> xxx </span>
and replace each match with nothing, what remains is the content
xxx
(with a space at each end).
If that is not the result you want please explain what is.
Hello,
Yes, Amigo has stated the problem correctly.
I want to delete exactly this:
<span class="mozp"></span>
Only this specific tag; not all span tags.
while leaving the content inside the tag as is.
The regex supplied deletes the front <span class="mozp"> but leaves the content AND the close </span>
This is to be done on multiple files with multiple instances likely in most files where it occurs. So I am assuming this is a job for WildEdit.
Yes, Amigo has stated the problem correctly.
I want to delete exactly this:
<span class="mozp"></span>
Only this specific tag; not all span tags.
while leaving the content inside the tag as is.
The regex supplied deletes the front <span class="mozp"> but leaves the content AND the close </span>
This is to be done on multiple files with multiple instances likely in most files where it occurs. So I am assuming this is a job for WildEdit.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
The regex
</?span\b[^>]*>
matches opening tags and closing tags. Perhaps you included a space at the end of it.
If the opening tags you are concerned with all look exactly like this
<span class="mozp">
then try searching for
<span class="mozp">([\s\S]*?)</span>
or
(?s:<span class="mozp">(.*?)</span>)
and replacing with
$1
</?span\b[^>]*>
matches opening tags and closing tags. Perhaps you included a space at the end of it.
If the opening tags you are concerned with all look exactly like this
<span class="mozp">
then try searching for
<span class="mozp">([\s\S]*?)</span>
or
(?s:<span class="mozp">(.*?)</span>)
and replacing with
$1
Hello Ben,
Both of those appear to work, but with \1 rather than $1 for the replacement.
I have tried these on both the test window and on a real html file.
I confess: I spent several hours trying to make these work and failed because: 1. the sample I used for testing used <p class="mozp"> (another tag I was looking for previously; and
2. the html file I was testing on lacked a header and footer. Just saved a text file as html so the content was apparently not recognized in some way.
Many thanks for your help here, and apologies all around for my confusion.
PS: Like some others recently, when pressing 'submit' I get DEBUG MODE but the post seems to go up eventually.
Both of those appear to work, but with \1 rather than $1 for the replacement.
I have tried these on both the test window and on a real html file.
I confess: I spent several hours trying to make these work and failed because: 1. the sample I used for testing used <p class="mozp"> (another tag I was looking for previously; and
2. the html file I was testing on lacked a header and footer. Just saved a text file as html so the content was apparently not recognized in some way.
Many thanks for your help here, and apologies all around for my confusion.
PS: Like some others recently, when pressing 'submit' I get DEBUG MODE but the post seems to go up eventually.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Hello Ben,
Tinkering with options in WE. Yes. I normally have this set to the PERL syntax, but with all the failures I used all three for each.
Aside from the syntax options I didn't alter any other options.
PS: Again:
DEBUG MODE
Line : 185
File : smtp.php
Tinkering with options in WE. Yes. I normally have this set to the PERL syntax, but with all the failures I used all three for each.
Aside from the syntax options I didn't alter any other options.
PS: Again:
DEBUG MODE
Line : 185
File : smtp.php
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm