Woundorf / foxreplace

Replace text in webpages
https://addons.mozilla.org/firefox/addon/foxreplace/
GNU General Public License v3.0
90 stars 22 forks source link

feature request: replace sentencing/next line? #377

Open wtfiwinomgs opened 3 months ago

wtfiwinomgs commented 3 months ago

Unsure what the term for this is but here is an example of original vs what I wish replacement looks like.

original: I walked today. A Lot. To the campus.

replacement: I walked today. A lot. To the campus.

basically the next line gets pulled up to save vertical spacing, wondering if this is possible.

iG8R commented 3 months ago

https://regex101.com/r/ldqykK/1

(I walked today\.)\n(A Lot\.)\n(To the campus\.)

image

wtfiwinomgs commented 3 months ago

https://regex101.com/r/ldqykK/1

(I walked today\.)\n(A Lot\.)\n(To the campus\.)

image

hey thanks for replying, I tried this on the above example but doesn't seem to work, not sure what im doing it wrong. using one in your screen shot and then choosing regular expression instead of text in drop down and still not working.

Woundorf commented 3 months ago

It could be as simple as replacing \n with ` (using regular expressions) if it's simple text, e.g. in a form. However, if it's HTML you have to enable HTML "Input & output" mode and then replace things like

\s*

|
with `. This last one should work in most places, but it will remove all line breaks. You have to add some kind of context to limit it, similar to @iG8R's answer.