Menu

#11 Regex not working for find/replace

open
nobody
None
5
2012-11-10
2012-08-02
No

Search for:
new display_information(\(.*?, .*?, .*?), .*?;

Replace with:
spiderRequestString\1);

Checked the following check boxes/radio buttons:
Regular Expression Mode
Wrap Search
Search For String
Replace
Replace All

Sample of file contents to be replaced (works correctly through the eclipse find/replace UI):
new display_information(0, $strUrl, $query, $testDescription);
new display_information(0, $strUrl, $query."&locale=".$arrLocale[array_rand($arrLocale)], $testDescription);
new display_information(0, $strUrl, $query."&locale=".$arrLocale[array_rand($arrLocale)], $testDescription);

Workaround:
Use Eclipse built in Find/Replace instead of the macro that was recorded
Other simple search/replace seem to work fine

Discussion

  • deirdra strangio

    Screenshot of Macro Recorder Find/Replace dialog with regex in it

     
  • deirdra strangio

    Recorded command makeup:
    Perform Find with the following parameters:
    Search String: new display_information(\(.*?, .*?, .*?), .*?;
    Case Sensitive: false
    Search Forward: false
    Match whole word: false
    Selection scope: false
    Wrap Search: true
    Reg Exp Mode: true
    Replace All: true
    Replace String: spiderRequestString\1);

     
  • deirdra strangio

    Ok figured it out, you need to always set:
    Search Forward: true

    Since Eclipse always has 'Forward' or 'Backward' selected using a radio button, it will always work thought it's search/replace UI, but in the macro recorder UI this is totally optional.

     

Anonymous
Anonymous

Add attachments
Cancel