Menu

#3357 Regexp Search "^\s*.*$" matches every 2nd line

closed-fixed
5
2010-01-05
2009-12-16
Nico Max
No

I've encountered that certain regexp patterns only matches every 2nd line.

Steps to reproduce

- 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

Test Environment

- Jedit v4.3pre18
- java v1.6.0_16
- started from scratch without any ".jedit"-Folder; no plugins or settings

Discussion

  • michael michaud

    michael michaud - 2009-12-16

    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

     
  • jst

    jst - 2010-01-05

    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?

     
  • jst

    jst - 2010-01-05

    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.

     
  • Kazutoshi Satoda

    Fixed in r16846.

     
  • Kazutoshi Satoda

    • assigned_to: nobody --> k_satoda
    • summary: Regexp Search matches every 2nd line --> Regexp Search "^\s.$" matches every 2nd line
    • status: open --> closed-fixed
     

Log in to post a comment.