Loading ...
Sorry, an error occurred while loading the content.

Re: [NTS] Complicated search and replace expression

Expand Messages
  • Ben B
    On 2009-01-14 01:46:47 afzalnj wrote regarding; [NTS] Complicated search and replace expression ... You ve discovered tagged matches on your own. All you
    Message 1 of 7 , Jan 14, 2009
    View Source
    • 0 Attachment
      On 2009-01-14 01:46:47 afzalnj wrote regarding; "[NTS] Complicated search and replace expression"

      > ok, i can now find the text i want to replace using this Regular
      > expression
      >
      > \\resource\\(\w+)\.py"-"\!\:\\private\\a000bd8c\\
      >
      > but how to replace it so it looks something like this
      >
      > \\resource\\(\w+)\.py"-"\!\:\\resource\\
      >
      > where (\w+) remains unchanged??

      You've discovered tagged matches on your own. All you need now is a
      back-reference.

      An expert should be along shortly. Until then, this should do what you
      want:

      Find
      \\(\w+)\\(\w+)\.py"-"!:\\.*

      Replace with
      \\$1\\$2.py"-"!:\\$1\\

      HTH
      Ben
    • afzalnj
      sorry bro, maybe i failed in explaining the problem...but now u know ;) ... variable. ... wanna do ... replaced
      Message 2 of 7 , Jan 15, 2009
      View Source
      • 0 Attachment
        sorry bro, maybe i failed in explaining the problem...but now u know ;)

        --- In ntb-scripts@yahoogroups.com, "David Smart"
        <smartware.consulting@...> wrote:
        >
        > Well that was not what you said. To quote your first message ...
        >
        > > > so its something like this
        > > > Find this:
        > > > \resource\*"-"!:\private\a000bd8c\
        > >> >
        > >> > and replace it with:
        > >> > \resource\*"-"!:\resource\
        >
        > You were looking for the string "resource", not something that was
        variable.
        > And your replace part was explicitly "resource" as well.
        >
        > Perhaps you'd like to re-state your problem more accurately.
        >
        > Regards, Dave S
        >
        > ----- Original Message -----
        > From: "afzalnj" <afzalnj@...>
        > To: <ntb-scripts@yahoogroups.com>
        > Sent: Thursday, January 15, 2009 8:30 PM
        > Subject: Re: [NTS] Complicated search and replace expression
        >
        >
        > > no brother...i also have lines which are like this
        > >
        > > \sys\bin\_aosocketnativenew.pyd"-"!:\private\a000bd8c\
        > >
        > > obviously i cant replace !:\private\a000bd8c\ with c:\resource\ here
        > >
        > > i need this line to be
        > >
        > > \sys\bin\_aosocketnativenew.pyd"-"c:\sys\bin\
        > >
        > > i hope you understand... in this particular example
        > > _aosocketnativenew.pyd is the constant that i dont want to change
        > >
        > >
        > >
        > > --- In ntb-scripts@yahoogroups.com, "David Smart"
        > > <smartware.consulting@> wrote:
        > >>
        > >> Are you over-egging the pudding?
        > >>
        > >> To me it looks as though you simply want to replace the string
        > >>
        > >> "-"!:\private\a000bd8c\
        > >>
        > >> with
        > >>
        > >> "-"!:\resource\
        > >>
        > >> Where the only variable bit is the a000bd8c, and you don't want this
        > > in the
        > >> replace part anyway.
        > >>
        > >> Regards, Dave S
        > >>
        > >> ----- Original Message -----
        > >> From: "afzalnj" <afzalnj@>
        > >> To: <ntb-scripts@yahoogroups.com>
        > >> Sent: Thursday, January 15, 2009 8:46 AM
        > >> Subject: [NTS] Complicated search and replace expression
        > >>
        > >>
        > >> >I need to use the search and replace function. here's what i
        wanna do
        > >> > Note: I have not used any regular expressions here...
        > >> >
        > >> > i wanna find this:
        > >> > \resource\activeprofile.py"-"!:\private\a000bd8c\
        > >> >
        > >> > and replace it by
        > >> > \resource\activeprofile.py"-"!:\resource\
        > >> >
        > >> > now...the name "activeprofile.py" has to be the variable as its not
        > >> > the same for every entry
        > >> >
        > >> > so its something like this
        > >> > Find this:
        > >> > \resource\*"-"!:\private\a000bd8c\
        > >> >
        > >> > and replace it with:
        > >> > \resource\*"-"!:\resource\
        > >> >
        > >> > where * is whatever the filename is...and it should not get
        replaced
        > >> >
        > >> > also if its possible can i search for
        > >> > \^\*"-"!:\private\a000bd8c\
        > >> >
        > >> > and replace it with
        > >> > \^\*"-"!:\^\
        > >> >
        > >> > where ^ is what was in the place of ^ when text was found
        > >> > and * is what was in the place of *
        > >> >
        > >> > plz help me and reply quickly...this is a pkg script for a SIS file
        > >> > (for symbian installation)
        > >> >
        > >> > Thank you very much in advance
        > >> >
        > >> > update:
        > >> > ok, i can now find the text i want to replace using this Regular
        > >> > expression
        > >> >
        > >> > \\resource\\(\w+)\.py"-"\!\:\\private\\a000bd8c\\
        > >> >
        > >> > but how to replace it so it looks something like this
        > >> >
        > >> > \\resource\\(\w+)\.py"-"\!\:\\resource\\
        > >> >
        > >> > where (\w+) remains unchanged??
        > >> >
        > >> >
        > >> > ------------------------------------
        > >> >
        > >> > Fookes Software: http://www.fookes.com/
        > >> > NoteTab website: http://www.notetab.com/
        > >> > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        > >> >
        > >> > ***
        > >> > Yahoo! Groups Links
        > >> >
        > >> >
        > >> >
        > >>
        > >
        > >
        > >
        > > ------------------------------------
        > >
        > > Fookes Software: http://www.fookes.com/
        > > NoteTab website: http://www.notetab.com/
        > > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        > >
        > > ***
        > > Yahoo! Groups Links
        > >
        > >
        > >
        >
      • afzalnj
        ... search and replace expression ... You, my friend, are simply the best!!!!!! I works perfectly!!!! thanks a lot bro! i was using (/1) instead of $1 (habit
        Message 3 of 7 , Jan 15, 2009
        View Source
        • 0 Attachment
          --- In ntb-scripts@yahoogroups.com, Ben B <benb_i26up@...> wrote:
          >
          > On 2009-01-14 01:46:47 afzalnj wrote regarding; "[NTS] Complicated
          search and replace expression"
          >
          > > ok, i can now find the text i want to replace using this Regular
          > > expression
          > >
          > > \\resource\\(\w+)\.py"-"\!\:\\private\\a000bd8c\\
          > >
          > > but how to replace it so it looks something like this
          > >
          > > \\resource\\(\w+)\.py"-"\!\:\\resource\\
          > >
          > > where (\w+) remains unchanged??
          >
          > You've discovered tagged matches on your own. All you need now is a
          > back-reference.
          >
          > An expert should be along shortly. Until then, this should do what you
          > want:
          >
          > Find
          > \\(\w+)\\(\w+)\.py"-"!:\\.*
          >
          > Replace with
          > \\$1\\$2.py"-"!:\\$1\\
          >
          > HTH
          > Ben
          >


          You, my friend, are simply the best!!!!!! I works perfectly!!!!
          thanks a lot bro! i was using (/1) instead of $1 (habit from MS word)

          can't thank you enough right now !! :D:D!
        Your message has been successfully submitted and would be delivered to recipients shortly.