Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

visual studio replace regexp help

Back to Forum: Tech Off
  • User profile image
    caroço

    hi,

    i'm not very good with regular expressions and i was wondering if somebody could help me building one to use in vs.net search and replace to change all ocurrences of

    localizedStrings.item(*)

    to

    localizedStrings[*]

    thanks

  • User profile image
    sloppycode

    So localizedStrings.item(<any match>) to localizedStrings[<any match>]

    is

    search: localizedStrings\.item\((.*)\)
    replace: localizedStrings\[\1\]

    should do the trick

  • User profile image
    Sven Groot

    sloppycode wrote:
    So localizedStrings.item(<any match>) to localizedStrings[<any match>]

    is

    search: localizedStrings\.item\((.*)\)
    replace: localizedStrings\[\1\]

    should do the trick

    Almost right. VS doesn't use entirely the same syntax as the .Net Framework regex class (for reasons no one knows) so you need to use {} to capture in the find expression instead of ().

  • User profile image
    caroço

    yeah youre right adding {} does the trick

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.