#252 search / replace on several lines with regular expression

Feature_Request
closed-wont-fix
SciTE (627)
3
2005-02-03
2004-12-29
No

Dear Scintilla team,

I found that it is possible to detect the caracters LF
and CR in a file with the regular expressions. It is
easy : there are the patterns '\n' and '\r'.
For any details, see :
http://www.regular-expressions.info/reference.html

It is verry usefull if I want to search a string on
several lines. Example I want to replace
<table>
<tr>
<td>Hello</td>

</tr>

</table>

by

<table>
<tr>
<td>Hello></td>
<tr>
</table>

Unfortunately, Scite does not find the patterns '\n'
and '\r' when I process a search with the regular
expression checkbox selected.

Would it be possible to add this feature ?

Regards,

Xavier Ottolini

Discussion

  • Philippe Lhoste

    Philippe Lhoste - 2004-12-31

    Logged In: YES
    user_id=2556

    That's because in Scintilla, RE (regular expressions) are
    performed on line by line basis.

    If your need is just as described (I already do that
    frequently), you just have to type \r\n\r\n in the Find
    field, nothing in the Replace field, and check the
    "Transform backslash expressions" checkbox.

    Sometime, I wonder if we should re-enable whole document
    search with RE. This would need some more care while writing
    some RE, as search is greedy: the first time I searched for
    a void function, I typed
    "void .* {" as RE and got almost the whole file selected
    (first void found in file, last opening soft brace found in
    file...). That's why RE were restricted to line search, as
    it is the most used mode.
    Perhaps we need an additional switch to allow multiline search.

     
  • Neil Hodgson

    Neil Hodgson - 2005-01-04
    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-wont-fix
     
  • Neil Hodgson

    Neil Hodgson - 2005-02-03
    • status: open-wont-fix --> closed-wont-fix
     
  • Shivan

    Shivan - 2010-02-19

    I'm experiencing the same problem.

    I'm trying to ad something to each end line...
    for example:

    line1
    line2

    I'm trying to replace \r\n to X\r\n

    to get
    line1X
    line2X

    But I don't know how. SearchReplace with RegExp and/or transform slashes did not work.

    Is there any solution yet? I'm using SciTE 2.03

     

Log in to post a comment.