• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validating a syntax

 
anoop kerala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i want to verify a string whether its given in the format,

a=b+c;

and prompt error if given,
1) a=;
2) a;
3) a=b+;

thank you..
lenin
 
Aditya Kanitkar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a=b+c


You will have to form a Regular Expression which resembles to "c=a+b"

Any string that unmatches the given format/expression can be identified.
 
Sherif Shehab
Ranch Hand
Posts: 485
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , You need to use Regular Exp.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far?
 
anoop kerala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tried but not postable..
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the thing--we need you to DoYourOwnHomework. Without evidence of ShowSomeEffort, you're not likely to get much help.
 
anoop kerala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks.. i will try to come up with a postable code..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic