I have an XHTML document where I have to replace the Newline before a word the word can be anything
Eg: string i need to replace =>“i like
this place”
string that need to be changed like this => i like this place"
I have an XHTML document where I have to replace the Newline before a word the word can be anything
Eg: string i need to replace =>“i like
this place”
string that need to be changed like this => i like this place"
i have to replace all the newline before a word from a entire XTHML document so if i use this it will remove all the newline from that document i only need to replace a “newline before a word”.
Eg: The document contains a close span tag followed by a newline and some word. i need to remove the newline from these types of occurence in the entire document.
You have to do a LookAhead (this place) and LookBehind (i like) and replace the newline character to single space character.
LookAhead pattern is (?=this\p{Zs}place)
LookBehind pattern is (?<=i\p{Zs}like)
RegEx pattern is (?<=i\p{Zs}like)([\p{Zl}]+)(?=this\p{Zs}place) <== this only replaces newline characters, if any other characters present will failed
Note:
space separator is \p{Zs}
newline separator is \p{Zl}
Please also refer here for RegEx tutorials