Page 1 of 1

RE Search & Replace for lines with a specific HEX

Posted: Sun Nov 15, 2009 6:50 pm
by iandg
Hi All

I want to insert text into the end of all lines in a document that contain a specific hex character value (0x97 representing —) so a block of text like:-

Code: Select all

Post your question in our Community Forums, where many 
expert users may be able — to help you out. 
Suggest and vote for enhancements in our Enhancement Suggestion Forum. 
Only if you have exhausted every other option, or have a 
purchase — or licensing question, submit your query using the 
TextPad feedback form or the WildEdit feedback form. 
becomes:-

Code: Select all

Post your question in our Community Forums, where many 
expert users may be able — to help you out. xxxx
Suggest and vote for enhancements in our Enhancement Suggestion Forum. 
Only if you have exhausted every other option, or have a 
purchase — or licensing question, submit your query using the xxxx
TextPad feedback form or the WildEdit feedback form. 
The document has complex multi-line records which happen to have a '—' in the last line of each record. Having flagged the last line feed of each record with xxxx, all line feeds will be replaced with tabs and then the xxxx replaced with a line feed.

If there is another way to achieve the same result I am open to any suggestions

Posted: Sun Nov 15, 2009 10:31 pm
by ben_josephs
Find what: \x97.*
Replace with: \0 xxxx

[X] Regular expression
Or just paste an em dash into the search expression (in place of the \x97).

Thanks Ben

Posted: Mon Nov 16, 2009 9:42 am
by iandg
That worked fine, thank you.

Just to correct my original post, I will have to replace xxxx\t with the \n after converting all the line feeds to tabs.