Regular Expressions

Author Topic: Regular Expressions  (Read 3570 times)

Offline AlexTopic starter

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 2
  • Posts: 65
  • Karma: 2
Regular Expressions
« on: 04-21-2010, 16:37:48 »
how can I test if a user typed a number or a boolean value using RegEx?

The number can be ANY number;
The boolean value should be 'true' or 'false' (lowercase);
Also need a sample for boolean value 'true' or 'false' (lowercase OR uppercase);


Offline Nicpoint45

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 3
  • Posts: 55
  • Karma: 3
Re: Regular Expressions
« Reply #1 on: 04-21-2010, 16:38:14 »
For number, use

/\d+/g

Regular expression must be used on string and cannot be used on boolean value.

Offline tradedemon

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 0
  • Posts: 34
  • Karma: 2
Re: Regular Expressions
« Reply #2 on: 05-10-2010, 03:47:15 »
I'd use something like this

/(true|false|[0-9]*)/




 

Related Topics

  Subject / Started by Replies Last post
0 Replies
724 Views
Last post 05-07-2015, 22:53:49
by pamelov
1 Replies
875 Views
Last post 10-14-2016, 02:42:56
by Victorvictories