in reply to Re: string matching
in thread string matching
I tried to match this pattern using something like: { $line=~/\(?\s(\*.+?\*\s(\,\s)?)+and\*.+?\*\s\)?/; } but it does not work.
This pattern in a sentence can potentially appear anaywhere in a sentence, such as, start, middle, or end of sentence. Also, there can be multiple such patterns in a single sentence. For example, the pattern can appear as (a comma may or may not be present before 'and'):
*q(53)* and *s7* are related with: ( *r:72* , *p/93* , and *s8* ) , and they are also related with *s:2* , *u6* , *g78* but not *s8* . In this example I want to cluster and tag, "*q(53)* and *s7*", "*r:72* , *p/93* , and *s8*" and "*s:2* , *u6* , *g78*" together in the sentence such that the sentence will look like:
*q(53)#and#s7* are related with: *(#r:72#,#p/93#,#and#s8#)* , and they are also related with *s:2#,#u6#,#g78* but not *s8* . Please note that when there is 'but not' then only the preceding part of the pattern is selected.
Thanks very much.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: string matching
by BrowserUk (Patriarch) on Aug 01, 2009 at 19:20 UTC |