[ragel-users] Need Help on Backward Reference concept of Regular Expression in Ragel Language

Adrian Thurston thurston at complang.org
Thu Dec 18 04:24:39 UTC 2008

Hi Hardik,

There is no inbuilt support for back references. What you'll have to do 
is to capture the text of the back reference, then in the place where 
you wish the back reference to appear give a pattern that subsumes the 
back reference, and then test the strings at runtime using a call to 
strcmp in a condition.


Hardik Parikh wrote:
> Hi
> I want to use backward reference in ragel regular expression for 
> creating parser for my language. The requirement is kind of begining and 
> end of tag matching where tag can be any arbitary string. e.g
> 1./test/ this is sample /test/
> or it can be
> 2./hello/ this is test /hello/
> and following can be consider as a invalide
> 3./abc/ this is invalid /xyz/
> So as in above example tag can be any arbitary string but requirement is 
> to match begining and ending tag string should be same. To write regular 
> expression for above requirement in ragel language i want to use 
> backward reference as in javascript. So can somebody give valuable 
> suggestion how can we achieve it in ragel or any pointer related to same 
> would be great help
> Thanks & Regards
> Hardik Parikh
> DISCLAIMER ========== This e-mail may contain privileged and 
> confidential information which is the property of Persistent Systems 
> Ltd. It is intended only for the use of the individual or entity to 
> which it is addressed. If you are not the intended recipient, you are 
> not authorized to read, retain, copy, print, distribute or use this 
> message. If you have received this communication in error, please notify 
> the sender and delete all copies of this message. Persistent Systems 
> Ltd. does not accept any liability for virus infected mails.
> ------------------------------------------------------------------------
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users

More information about the ragel-users mailing list