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

Regular Expression

Expand Messages
  • freaklair
    Just wondering if anyone can help me out, I am trying to make an RE that can match lines of the format echo blahblah blah n ; OR echo blahblah blah ; and
    Message 1 of 3 , Sep 30, 2002
      Just wondering if anyone can help me out, I am trying to make an RE
      that can match lines of the format

      echo "blahblah blah\n";

      OR

      echo "blahblah blah";

      and give me the blahblah blah

      so far I have got

      ^echo "(.*)[(\\n)]?";

      But I think the .* is being greedy and matching the \n at the end of
      the line. In perl you can go .*? to make it not greedy but ediplus
      doesn't support this.

      Can anyone come up with a one command replace to do this ? Or am I
      just going to have to put up with doing two ?
    • J
      Try this: ^echo ([^ ]*)( n)? ;
      Message 2 of 3 , Oct 1, 2002
        Try this:

        ^echo "([^\\]*)(\\n)?";

        --- In editplus@y..., "freaklair" <freaklair@y...> wrote:
        > Just wondering if anyone can help me out, I am trying to make an RE
        > that can match lines of the format
        >
        > echo "blahblah blah\n";
        >
        > OR
        >
        > echo "blahblah blah";
        >
        > and give me the blahblah blah
        >
        > so far I have got
        >
        > ^echo "(.*)[(\\n)]?";
        >
        > But I think the .* is being greedy and matching the \n at the end of
        > the line. In perl you can go .*? to make it not greedy but ediplus
        > doesn't support this.
        >
        > Can anyone come up with a one command replace to do this ? Or am I
        > just going to have to put up with doing two ?
      • freaklair
        Thanks but I dont want it to skip a line if it has a in it because you can put things like in the quotes ... i just want to strip of the n if its the
        Message 3 of 3 , Oct 2, 2002
          Thanks but I dont want it to skip a line if it has a \ in it because
          you can put things like \" in the quotes ... i just want to strip of
          the \n if its the last thing inside the quotes.

          --- In editplus@y..., "J" <banana@l...> wrote:
          > Try this:
          >
          > ^echo "([^\\]*)(\\n)?";
          >
          > --- In editplus@y..., "freaklair" <freaklair@y...> wrote:
          > > Just wondering if anyone can help me out, I am trying to make an
          RE
          > > that can match lines of the format
          > >
          > > echo "blahblah blah\n";
          > >
          > > OR
          > >
          > > echo "blahblah blah";
          > >
          > > and give me the blahblah blah
          > >
          > > so far I have got
          > >
          > > ^echo "(.*)[(\\n)]?";
          > >
          > > But I think the .* is being greedy and matching the \n at the end
          of
          > > the line. In perl you can go .*? to make it not greedy but ediplus
          > > doesn't support this.
          > >
          > > Can anyone come up with a one command replace to do this ? Or am I
          > > just going to have to put up with doing two ?
        Your message has been successfully submitted and would be delivered to recipients shortly.