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

Re: Expression worked in beta1 is error in beta2-Sorry Clippers,

Expand Messages
  • Gary Oliver
    Again I have to say Sheri is right. Although I am really confused, at work it took me the greater part of a day fix a script that in one part put a line break
    Message 1 of 6 , Jul 22, 2006
      Again I have to say Sheri is right. Although I am really confused, at
      work it took me the greater part of a day fix a script that in one
      part put a line break in front of comments. No matter what I did it
      refused to match comments.
      Now though I tested Sheri's suggestion and it works. Not only that but
      in both betas I seem to be able to match comments without escaping
      anything.
      Although I have to say Sheri is also right about escaping that list of
      characters.

      The only thing I can imagine is that what ever I did to really fix my
      original expressions it must have been coincidental to trying
      character class notation thereby making me think that was the answer.
      (Either that or since then I have stepped thought a portal to a
      different reality.)

      Sorry Clippers, Sorry Eric,
      Gary


      --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
      >
      > Hi Gary,
      >
      > If you will try it with a backslash in front of each angle brackets
      > and exclamation point in the search text portion, you will see that
      > it works also (no need for the character class). You still didn't do
      > anything about your closing angle bracket. Since it is not escaped or
      > in a character class, you risk having it used in unexpected ways
      > since it is a metacharacter.
      >
      > I reloaded the earlier beta and tried your expression with \B+ in it.
      > If I removed the S(ilent) option from the ^!Replace command, all it
      > says is that no replacements were made. IOW, the expression might
      > have appeared to "work" but it didn't actually trigger any
      > replacements. Other than the error message, another difference from
      > beta1 to beta2 is that now the rest of the clip following a regex
      > error is aborted. This is good, because the rest of the clip probably
      > depends on the regular expression being capable of matching something.
      >
      > Regards,
      > Sheri
      >
      > --- In ntb-clips@yahoogroups.com, "Gary Oliver" <OLIVERG@> wrote:
      > >
      > > Sherri was right \B+ is wrong \S+ worked without error.
      > > Thanks I have a better understanding now of word boundry and simple
      > > assertions.
      > > ^!Replace "[<][!]-- EDITED-DATE\s*\S+\s*\S+\s*-->" >> "<!--
      > > EDITED-DATE ^%user% ^$GetDate(yyyy/mm/dd-HH:mm)$ -->" RWAIS
      > >
      > >
      > >
      > > --- In ntb-clips@yahoogroups.com, "Gary Oliver" <OLIVERG@> wrote:
      > > >
      > > > Hi, Thanks
      > > > I think you are right about the \B+ but it did work in beta1. Also
      > > > those characters do need to be escaped BUT not in character
      > classes
      > > > where I had them.
      > > > And the reason I had them in character classes is because of
      > strange
      > > > behavior in the new regex in clips that does not allow you to find
      > > > HTML comments unless you do exactly this [<][!] on the first to
      > > > characters.
      > > > I have not worked Assertions into my repertoire yet but I think
      > it is
      > > > because <! Is part of the syntax of assertions that you need to
      > put
      > > > HTML comments first to characters into character classes.
      > > > All this comes through testing and converting my 495 clips to
      > beta 5-1
      > > > then 5-2.
      > > >
      > > > --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@>
      > wrote:
      > > > >
      > > > > Hi,
      > > > >
      > > > > I see several things wrong with your pattern, but what it is
      > > > > complaining about is the pluses on your \B's. \B is a zero
      > length
      > > > > assertion which matches when not at a word boundary. It can't
      > be
      > > > > repeated, it does not mean a non-word character.
      > > > >
      > > > > Any of the following metacharacters need to be escaped with a
      > > > > backslash when you need them to match your data:
      > > > >
      > > > > \^!$?.*<>+()[]{}=|:
      > > > >
      > > > > Instead of escaping them, you put two of them in their own
      > character
      > > > > classes. Its not what character classes are for, but should
      > work. You
      > > > > missed your closing angle bracket. :)
      > > > >
      > > > > Haven't seen your document data, but this is how I think I'd do
      > it
      > > > > (uses lookbehind and lookahead assertions):
      > > > >
      > > > > ^!Replace "(?<=\<\!--EDITED-DATE).*?(?=--\>)" >> "^%user%
      > ^$GetDate
      > > > > (yyyy/mm/dd-HH:mm)$" RWAIS
      > > > >
      > > > > Next should also work (uses target subpattern 2):
      > > > >
      > > > > ^!Replace "(\<\!--EDITED-DATE)(.*?)(--\>)" >> "^%user% ^$GetDate
      > > > > (yyyy/mm/dd-HH:mm)$" RWAIS2
      > > > >
      > > > >
      > > > > --- In ntb-clips@yahoogroups.com, "Gary Oliver" <OLIVERG@>
      > wrote:
      > > > > >
      > > > > > ^!Replace "[<][!]-- EDITED-DATE\s*\B+\s*\B+\s*-->" >> "<!--
      > > > > > EDITED-DATE ^%user% ^$GetDate(yyyy/mm/dd-HH:mm)$ -->" RWAIS
      > > > > >
      > > > > > First I get an error that says "regex error: nothing to
      > repeat" then
      > > > > > it says the line above is the problem
      > > > > > It worked in beta 1.
      > > > >
      > > > > Can you post some data it worked on? Most likely it just told
      > you
      > > > > there were no matches.
      > > > >
      > > > > Regards,
      > > > > Sheri
      > > > >
      > > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.