Re: Correction



Hi Jules,

Check out how you can use "?" as a lazy modifier to existing quantifiers:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconquantifiers.asp

And negative lookbehind assertion:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpcongroupingconstructs.asp

Try this with the IgnorePatternWhitespace and Singleline options:

string pattern =
@"(?<sentence>.*? ) # lazily match sentence so that '.' does not capture eos
(?<eos> (?<! /) # negative lookbehind for /
/)?$ # match single '/' at end of string or just end of string";

--
Dave Sexton

"Jules" <eric.alexis.bruno@xxxxxxxxx> wrote in message news:1155863146.762496.119230@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sorry, misspelling: please read "(?<sentence>.*(?<eos>[^\\][\\]{1}$)?)"
as "(?<sentence>.*(?<eos>[^/][/]{1}$)?)"

J.

Jules wrote:
All,

how do I describe a string consisting of any number of characters, with
an optional (but unique when occuring) end-of-line expression '/'? With
groups if possible, as in "(?<sentence>.*(?<eos>[^\\][\\]{1}$)?)"

Say I have the phrase 'My Taylor is /' as input; I'd like 'sentence'
and 'eos' to match.

Now if I have 'My Taylor is //' or 'My Taylor is / ', 'sentence' should
match, but not 'eos'. In other words, 'eos' should match only when it
occurs once, and last, in the string.

I have tried nesting eos within sentence, juxtaposing them, removing
quantifiers, removing the end-of-string assertion... nothing seems to
work satisfactorily.

Thanks for any help,
Jules



.



Relevant Pages

  • HCM BLACK PAPER
    ... EOS in it not counting the normal EOS at end of string. ... There is not free lunch in compression ... My Crypto code ...
    (comp.compression)
  • Re: set Kmail as my default
    ... >> EOS wrote: ... I'm guessing that's the wrong string! ... to "kmail" no path just "kmail" ...
    (alt.os.linux.suse)
  • Re: Correction
    ... Dave Sexton wrote: ... 'eos' should match only when it ... occurs once, and last, in the string. ... Delphi skills make .NET easy to learn In print, in stores. ...
    (microsoft.public.dotnet.general)
  • Re: memory exhausted
    ... string. ... And thats how far I got. ... The error is coming from the parser. ... eval <<EOS ...
    (comp.lang.ruby)
  • How do I use heredocs
    ... QuickTest.rb:21: can't find string "EOS" anywhere before EOF QuickTest.rb:6: syntax error ...
    (comp.lang.ruby)