You can pick an obscure character and apply a don’t match character range with it ie
[^`]+. This is not true match any character though. Or you can try
[.\r\n]+ which doesn’t seem to work at all.
(?:\r|\n|.)+ works fine, but as you’ll find out soon, it is notoriously slow as each time you use it, you are creating a new 3 way branching point because of the brackets.
The perfect way I’ve found is actually a nicer variation of the first idea:
Which means ‘don’t match no characters’, a double negative that can re-read as ‘match any character’. Hacky, but works perfectly.
‘A\nB’.match(/[^]+\nB/) fails in Internet Explorer 9. Use [\S\s] instead!
Nice hack, but it’s this slower then .* for example ?
You’ve saved me an hour of headache with this! – Wish i had this level of creative and out-of-the box thinking.
Wow, thank you very much! Stackoverflow this pls.
A very, very great idea!!! :-) Many thanks!
I had to do search and replace so I modified the code as .replace(//mgi, “”)
spent days trying to figure out matching between characters that have multi line & this man comes up with just [^]+ which gets any char in between, a lot of people always say they know their stuff but a few people really know their stuff; this man is one of them.
this removes everything except a square empty box.
this removes everything up to & including the empty square box & the space after it.