OR in a regex
From: Colm Gallagher (colm.gallagher_at_gmail.com)
Date: 09/30/04
- Next message: Colm Gallagher: "Re: OR in a regex"
- Previous message: Ramprasad A Padmanabhan: "How to set default text on Tk::Text"
- Next in thread: Colm Gallagher: "Re: OR in a regex"
- Reply: Colm Gallagher: "Re: OR in a regex"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Sep 2004 09:03:55 +0100 To: beginners@perl.org
Hi Folks,
Struggling to understand what is happening here...
Example of text is
Description Supports the management of the process to create and
complete an order Actors SYSTEM Pre-Conditions A Service Instance may
have been selected for the purchase
This regex extracts the text
/Description([^.]+)(?:Actors)/
Supports the management of the process to create and complete an order
In some cases, the word "Actors" that I want to terminate on is the
word "Steps" instead, so I though I'd use an OR inside parenthesis
with no backreferences ?: to match either Actors or Steps - this now
matches neither, so the pattern just runs to the end of the text
(?<!Change )Description([^.]+)(?:Actors|Steps)
any hints?
-- Colm
- Next message: Colm Gallagher: "Re: OR in a regex"
- Previous message: Ramprasad A Padmanabhan: "How to set default text on Tk::Text"
- Next in thread: Colm Gallagher: "Re: OR in a regex"
- Reply: Colm Gallagher: "Re: OR in a regex"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]