rickysarraf / foxreplace

Automatically exported from code.google.com/p/foxreplace
0 stars 0 forks source link

Add an option for multiline matching #95

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, multiline matching is enabled for all substitutions. Make it an 
option for each substitution.

Original issue reported on code.google.com by marc.r...@gmail.com on 19 Dec 2012 at 11:29

GoogleCodeExporter commented 9 years ago
Correction: Currently, multiline matching is not enabled for any substitution. 
Make it an option for each substitution.

Original comment by marc.r...@gmail.com on 23 Dec 2012 at 1:40

GoogleCodeExporter commented 9 years ago
A workaround in the meantime can be to use \n within the regex to represent 
newline (that works for me but others may need \r or \m). Not always a useful 
workround.

Original comment by sqgl2...@gmail.com on 21 Apr 2013 at 6:06

GoogleCodeExporter commented 9 years ago
Hi I think this is probably not a FoxReplace issue, but an issue of regular 
expressions in JavaScript.

I read somewhere that . does not match newline characters and that in case 
newline should be matched you can use
[\s\S] instead of the . so the expression .* would become [\s\S]*
and if this does what you need, I think it is even a better choice than to 
change extend FoxReplace, because this way you can distingiuish cases in which 
you want to match any character within a line and cases in which you want to 
match absolutely all possible characters in one and the same regexp (it makes 
it much more powerful).

Greetings
J

Original comment by jelz.the...@gmail.com on 27 Jun 2013 at 6:14

GoogleCodeExporter commented 9 years ago
Hi, the issue isn't about . but about $ and ^. The multiline flag has the 
following effect:

Treat beginning and end characters (^ and $) as working over multiple lines 
(i.e., match the beginning or end of each line (delimited by \n or \r), not 
only the very beginning or end of the whole input string)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
/RegExp

So it's still a valid enhancement, and since it will be a flag for each 
individual substitution you will still have the power to distinguish between 
any case ;)

Original comment by marc.r...@gmail.com on 27 Jun 2013 at 9:36