Hi,

I'm fairly new to regex. I know that the * is a greedy match. This is
currently giving me undesired results. How do I rewrite the regex below
so it will match up to the first } symbol it encounters.

To put this in context, I'm writing a regex based syntax highlighter.
Here is sample code I am having trouble with:

   function MyFunc: {$ifdef FPC}longword{$else}word{$endif};


The following regex matches the first { symbol up until the last }
symbol. :-(  I obviously want it to stop at the first } it encounters.

This is the regex I'm currently using:

    \s*\{\$.*\}


Any regex wizards that could help me here?

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to