regular expressions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gr4v3
Forum Newbie
Posts: 1
Joined: Mon Sep 18, 2006 12:50 pm

regular expressions

Post by gr4v3 »

I have a string like "if(a > b,if(a > c,true,false),false)" and i want to parse it with regular expressions to work like a if...then..else procedure.
It's easy if i do with just "if(a > b,true,false)" but i want to support nested conditions but i cant get no solution =S besides im new to regular expressions =S

Any one knows how to do it ??? :)
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

Use

Code: Select all

##code
##code
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Write a string parser. Regular expressions are not designed to handle nesting too well/easily.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

feyd wrote:Write a string parser.
presumably stack-based?
Post Reply