negative lookahead Regular Expression

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf negative lookahead Regular Expression

  • Creator
    Topic
  • #48997
    Daniel Lee
    Participant

    I’m trying to find a regular expression that will route everying starting with R01 except R01MDOC.

Viewing 4 reply threads
  • Author
    Replies
    • #60360
      Daniel Lee
      Participant

      I’ve done some more digging here.

    • #60361
      Jamin Gray
      Participant

      Could you post the regex line in your tcl code?  I can’t duplicate the problem in hcitcl

      Code:


      hcitcl>set x R01MDOC
      hcitcl>regexp {R01(?!MDOC)} $x match
      0

      hcitcl>set x R01GENLAB
      hcitcl>regexp {R01(?!MDOC)} $x match
      1

      Seems to be working….

    • #60362
      Daniel Lee
      Participant

      I get the same result as you in hcitcl but when I try to use the lookahead in the route and then use the route test tool it tells me that there are no routes defined.

    • #60363
      Daniel Lee
      Participant

      I’ve been testing some more with this and can’t get a negative lookahead to work at all in a wildcard route.  Is this a limitation of the engine?  It works with the version of TCL the egine is using but will not work in the route.  I can’t figure out a way to write this logic without doing a negative lookahead.  Surely someone else has tried to do what I’m doing.

    • #60364
      Daniel Lee
      Participant

      I figured this out.  I had to use the following expression:

      R01(?!MDOC).*

      I’m not sure why, hcitcl works without the .* at the end but the engine route will not work without it.

Viewing 4 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10