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

22580[NTB] Re: Remove x number of characters from a line of text

Expand Messages
  • biwilliams
    May 28, 2012
      OK, I am learning (slowly).... starting to use some regexes after some trial and error.
      But I now have a new need which I have yet to master.
      Hoping you guys can help....
      Let's say I have repetitive lines in my data.
      I have a used the expression -[2-9].* to remove all data from a line whenever a digit between 2 and 9 follows a hyphen.
      This has worked beautifully to help me visually see those lines within the whole set.
      But what I really want is to be able to delete those lines completely from the data set.
      Is there a way, either prior to, or after using the aforementioned regexp, to delete the line in its entirety?
      If this helps, after running that expression, the lines of data to be deleted are now only 8 characters in length. Is there a way to say "if a line only contains 8 characters (including whitespaces), delete that whole line"?
      Thanks in advance!

      --- In notetab@yahoogroups.com, "biwilliams" <studio@...> wrote:
      > Thanks Marcelo!
      > --- In notetab@yahoogroups.com, Marcelo Bastos <bytext@> wrote:
      > >
      > > Interviewed by CNN on 28/05/2012 19:13, biwilliams told the world:
      > > > Thanks for all the replies, guys!
      > > > Can anyone explain (briefly) what is meant by 'greedy' and 'non greedy' parameters, please?
      > >
      > > "Greedy" means what the name implies: it will try to match the largest
      > > possible string that corresponds to the parameters. "Non-greedy" will
      > > try to match a smaller string.
      > >
      > > Generally speaking, greedy matches tend to give you bad surprises. For
      > > instance, if you greedy-search a string beginning with "g" and ending
      > > with "y" in this message, you will get a match corresponding to almost
      > > the entire message. A non-greedy match will try to avoid that in various
      > > ways -- for instance, by ensuring that the intervening characters can
      > > only be alphabetic (no spaces, newlines and punctuations). A non-greedy
      > > search will find "greedy" and "generally", among others, but will not
      > > consider (almost) the entire message as a match.
      > >
      > > --
      > > MCBastos
      > >
      > > This message has been protected with the 2ROT13 algorithm. Unauthorized
      > > use will be prosecuted under the DMCA.
      > >
      > > -=-=-
      > > ... Sent from my iBot.
      > > * Added by TagZilla 0.7a1 running on Seamonkey 2.9 *
      > > Get it at http://xsidebar.mozdev.org/modifiedmailnews.html#tagzilla
      > >
    • Show all 22 messages in this topic