Re: EdSharp - Another Regular Expression Question
- From: "tribble" <lauraeaves@xxxxxxxxx>
- To: <programmingblind@xxxxxxxxxxxxx>
- Date: Wed, 30 Jul 2008 11:37:19 -0500
Hi Jamal --
Well that was simple -- when all else fails, read the instructions...*smile*
And this would be like C comments, matching everything after the <note>,
including nested <note> elements and terminating when it hits the first
</note> -- which is probably what was wanted in the first place. Now if he
wanted to handle nested snotes, or do any other recognition and
transformation of stuff in the note, that would complicate things..
Thanks for clarifying.
--le
----- Original Message -----
From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, July 30, 2008 11:13 AM
Subject: Re: EdSharp - Another Regular Expression Question
EdSharp fully supports the regular expression syntax of the .NET
Framework, documented at
http://msdn2.microsoft.com/en-us/library/hs600312(vs.80).aspx
A regular expression can match multiple
lines, though the expression is a bit more
complex because the . symbol matches any
character except a new line. Thus, one has
to match either . or \n in an alternation
group.
I think Jim can do what he wants using the
Extract with Regular Expression command,
Control+Shift+E, with the following
expression:
(?<=<note>)(.|\n)*?(?=</note>)
This gathers non-greedy matches of characters between the <note> and
</note> tags, where the tags, themselves, are excluded from the match
text. EdSharp puts the results in a new document window. Each match is
seperated by the section break sequence from the next one. The section
break characters may be removed with the regular Replace command,
Control+R.
Jamal
On Wed, 30 Jul 2008, tribble wrote:
> Date: Wed, 30 Jul 2008 09:38:10 -0500
> From: tribble <lauraeaves@xxxxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: EdSharp - Another Regular Expression Question
>
> I'd be curious if this could be done in edsharp--or rather, how extensive
> is
> the regular expression handling in edsharp?
> First of all, since the text you want to highlight can and probably will
> span several lines, a standare ed-like regular expression wouldn't work,
> unless you could set a state variable "highlighted" to true when you hit
> the
> "<note>" delimiter, then unset it when you hit the "</note>" delimiter. --
> and of course you need to save the positions of those delimiters.
> This joggles my memory of lexing verses parsing -- where lexing only uses
> regular expressions to tokenize the text, and the parser takes the tokens
> and applies a grammar (which goes beyond the capabilities of regular
> expressions) to translate the strings of tokens to internal data
> structures.
> In C, the comments (with delimiters /* and */) are handled by the lexer,
> but
> the regular expression doesn't do it directly -- you have to enter a
> comment
> state where you pretty much eat all the text until the closing delimiter.
>
> So my question is, does edsharp support this kind of thing?
> --le
>
>
> ----- Original Message -----
> From: <james.homme@xxxxxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Wednesday, July 30, 2008 8:42 AM
> Subject: EdSharp - Another Regular Expression Question
>
>
>
> Hi,
> I'm using EdSharp. I'm reading a book. I want to create a sort of fake
> highlighting kind of like a sighted person would use to mark up a book,
> only mine would work like this. I see something in a book that I want to
> come back to and possibly extract out of the book. I want to make an
> opening tag and a closing tag around the text. The tag is going to be
> something like <note> </note>. Then, I want to construct a regular
> expression that would search for <note> followed by any text or no text
> that is allowed to span multiple lines, followed by </note>. I want to
> extract the text excluding the tag. How do I construct the regular
> expression that does this?
>
> Thanks.
>
> Jim
>
>
>
>
> James D Homme, Usability Engineering, Highmark Inc.,
> james.homme@xxxxxxxxxxxx, 412-544-1810
>
> "it is only possible to live happily ever after on a day-to-day basis." --
> Margaret Bonnano
>
> Highmark internal only: For usability and accessibility:
> http://highwire.highmark.com/sites/iwov/hwt093/
>
> __________
> View the list's information and change your settings at
> http://www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> http://www.freelists.org/list/programmingblind
>
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
- References:
- EdSharp - Another Regular Expression Question
- From: james . homme
- Re: EdSharp - Another Regular Expression Question
- From: tribble
- Re: EdSharp - Another Regular Expression Question
- From: Jamal Mazrui
Other related posts:
- » EdSharp - Another Regular Expression Question
- » Re: EdSharp - Another Regular Expression Question
- » Re: EdSharp - Another Regular Expression Question
- » Re: EdSharp - Another Regular Expression Question
- EdSharp - Another Regular Expression Question
- From: james . homme
- Re: EdSharp - Another Regular Expression Question
- From: tribble
- Re: EdSharp - Another Regular Expression Question
- From: Jamal Mazrui