I've encountered that certain regexp patterns only matches every 2nd line.
- start jedit
- insert the folling test
abc
abc
abc
abc
abc
abc
(esentially "abc" every line with a space in front)
- open search dialog
- enter search pattern: ^\s*.*$
- enable "Regular Expressions" and "Keep Dialog"
- place cursor at top line at line start
- start search
Notice that only odd lines get matched on every successive search
- place cursor in the middle of the first line
- start search
Notice that only even line gets matched on every successive search
- Jedit v4.3pre18
- java v1.6.0_16
- started from scratch without any ".jedit"-Folder; no plugins or settings
Hi,
I could not find a good explanation but noticed that using the multiline option (?m) solve the problem.
In javadoc, it is said that default behaviour consider ^ as the start of the input, not the start of each line. But I cannot say what exactly the "input" means while performing several successive matches.
Michaël
2 things.
1) How do we turn on multiline in the Edit->Find
2) How do we do that on a script? I can set the regexp to MULTILINE but not setSearchString?
Using \n takes LONGER and does the same thing. But also in my case, I want to Find and Replace by Nothing and if I use $ it will not eat the \n character and leave and empty line.
Fixed in r16846.