On Saturday 22 August 2009 05:46:57 Brian Barker wrote:
> At 19:51 21/08/2009 +0200, Jonathan Kaye wrote:
> >Here is my second question, Pradeep, since you
> >know regular expressions quite well.
>
> Sorry, I'm not Pradeep; will I do?
That, Brian, is an understatement !!!! :-)
And Jonathan, thanks, but I just dabble with stuff.
> Actually, it's not quite as easy as
> that. Regular expressions match as much as
> possible: they are sometime described as
> "greedy". So your expression matches everything
> up to the *last* full stop in a paragraph, in fact. You need
> something like ^[^\.]*\.
> instead. The part enclosed in square brackets
> matches anything that is not a full stop.
In fact the "*" is greedier than the "+". How about the "+" instead
of the "*" ?
> >I would like to surround the matched material
> >with « at the beginning and » at the end. So,
> >for example, if a have a record like this:
> >delete.me, I would like to replace it with this: «delete»me Is
> > this possible?
>
> Yes. Search for
> ^([^\.]*)\.
> and replace with
> «$1»
This expression would probably do similar stuff
Search : ^([^\.]+)\.
Replace : «$1»
However, if one ran a SECOND or subsequent replace, the match occurs
even for the first (or prior) replacements. Probably this would help
to prevent it:
Search : ^([^\.(«|»)]+)\.
Replace : «$1»
I apologize for having taken the contents of this thread beyond the
initial request from the OP.
--
Pradeep V S
on 22 Aug 2009, Saturday, IST (which is GMT +05:30)
-----------------------------------------------------------------------
Goofy Definitions!
Democracy:
Three wolves and one sheep voting on what to have for supper.
-----------------------------------------------------------------------
Signature block is /auto/ /generated/ from the Unix utility *fortune*
fortune run at 07:20 IST on 22 Aug 2009, Saturday
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]