Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

remove tag but keep inner text

Marc — Oct 01, 2018 11:35PM CEST

Trying to strip out the button tag but leave behind the inner text.

<button data-toggle="modal" data-target="#dictionaryModal" data-term="startup">Save This Text</button>

Xpath help appreciated. Thanks!


2 Community Answers

Keyvan Minoukadeh - Oct 06, 2018 at 05:15PM CEST

FiveFilters.org Agent

Hi Marc,

This is not currently possible with Full-Text RSS. But you might have luck with a string replacement workaround:

find_string: <button data-toggle="modal" data-target="#dictionaryModal" data-term="startup">
replace_string:
find_string: </button>
replace_string:

If the button element is not always the same, you can try this hackier approach which converts the button tag to a self-closing (void) HTML element. For example:

find_string: <button
replace_string: <img style="display:none"
find_string: </button>
replace_string:

This should make the parser treat the tag separately from its inner text, and the style attribute should make it get removed entirely.

Hope that's some help.

rated : 2 Up Down

Marc - Oct 14, 2018 at 03:06AM CEST

Thanks, Keyvan.

Looks like I can use either of these solutions:

1.
find_string: <button
replace_string: <img style="display:none"

2.
replace_string(<button) : <img style="display:none"
replace_string(</button>) :

For some reason adding this to #1 causes it to not work:
find_string: </button>
replace_string:

But either 1 or 2 is fine for me, as </button> is stripped in both cases. BTW -- I'm on 3.6

Thanks much!

rated : 0 Up Down

Post Your Public Answer