find and replace text - is there a way to have it replace variable text?

822 Views | 7 Replies | Last: 5 yr ago by eric76
35chililights
How long do you want to ignore this user?
AG
for instance, i want to find all text strings that match:

date="1535218094566" type="2" subject="null" body

and replace with a blank space.

however, that date value changes on each line.

any way to do that?
pnut02
How long do you want to ignore this user?
AG
Notepad++
https://stackoverflow.com/questions/37742519/notepad-wildcard

Using the replace function:
Find what: date=".*" type="2" subject="null" body
Replace with: date=" " type="2" subject="null" body (or whatever you want to replace with)

Search Mode set to Regular expression

35chililights
How long do you want to ignore this user?
AG
thanks. i was doing this in notepad++ anyways. Thanks.
35chililights
How long do you want to ignore this user?
AG
period asterisk?

doesnt seem to be working.
35chililights
How long do you want to ignore this user?
AG
ok, so ".*" will make it search for the wildcard after the string, and asterisk will take it to the end of the line. anyway to have it re-recognize a text string and not go towards the end of the line?
ntxVol
How long do you want to ignore this user?
Works for me.

".*" should match everything within the first set of quotes in this case.

Make sure you don't have the ". matches newline" box checked.
35chililights
How long do you want to ignore this user?
AG
I couldnt get it to work.

line to replace
----- date="1535218094566" type="2" subject="null" body ----

if i did Find date=".*" type="2" subject="null" body
it wouldnt find anything.

if i did Find date=".*
it would return date= and the entire remainder of the line



i ended up forcing it to work, because luckily the date variable was a constant 13 characters long.

so i did Find date="............." type="2" subject="null" body

not sure what was going on, but you helped nonetheless. i wouldnt have gotten there without the spur.
pnut02
How long do you want to ignore this user?
AG
Glad you got it working
eric76
How long do you want to ignore this user?
AG
emacs
Refresh
Page 1 of 1
 
×
subscribe Verify your student status
See Subscription Benefits
Trial only available to users who have never subscribed or participated in a previous trial.