Re: Get regular expression
- From: "Xicheng Jia" <xicheng@xxxxxxxxx>
- Date: 20 Jun 2006 16:49:32 -0700
Mike wrote:
Xicheng Jia wrote:
Mike wrote:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in
matches. I would like to get what the actual regular expression is.
In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART (CONDUCTION
DEFECT) 37.33/2 HEART (CONDUCTION DEFECT) WITH
CATHETER 37.34/2 " the expression is "HEART (CONDUCTION DEFECT)". How
do I gain access to the expression (not the matches) at runtime?
you want to access the expression "HEART (CONDUCTION DEFECT)" or the
regex "^(.+)(?=\s*).*\1" at run-time?? dont think you can get exactly
the latter one though, for the previous one, you can use named capture,
like
^(?<expr>.+)(?=\s*).*\k<expr>
and access the variable "expr" at run time?
Xicheng
I want to access the expression "HEART (CONDUCTION DEFECT)" I'll try
your suggestion first off in the morning.
err, my bad. you need the match object's Groups property, like
Group("expr") or Group(1) to access the captured values..(Groups[...]
for C#)
Xicheng
.
- References:
- Get regular expression
- From: Mike
- Re: Get regular expression
- From: Xicheng Jia
- Re: Get regular expression
- From: Mike
- Get regular expression
- Prev by Date: Re: Html Rendering in Winforms
- Next by Date: Using Selection.ShapeRange to control Shapes
- Previous by thread: Re: Get regular expression
- Next by thread: Re: Get regular expression
- Index(es):
Relevant Pages
|
Loading