Login
Search
Welcome to the iTechForums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 3
Members:
Number of Users Online:
Welcome to our newest member,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-08-2008, 07:57 AM
Licursi Licursi is offline
Junior Member
 
Join Date: May 2008
Posts: 1
Default

What does this PERL expression mean?


/^[-+]?\d+\.\d+$/

Can someone please break this down for me?

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-08-2008, 07:58 AM
Aamina Aamina is offline
Junior Member
 
Join Date: May 2008
Posts: 2
Default

that's called a "regular expression"

you may want to do some research on regular expressions to figure out what they mean, but i'll break this down for you:

/^[-+]?\d+\.\d+$/
the first "/" and last "/" are only there to enclose the regular expression:

^[-+]?\d+\.\d+$
the "^" means to check from the beginning and "$" means to check all the way to the end.

[-+]?
the ? means to match 1 or 0 of any of the characters enclosed in the square brackets [ ]...

\d+
this means to match any digit character, represented by \d, and the "+" means to match any digit 1 or more times.

\.
this means to match a period

\d+
same as the other
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-08-2008, 07:58 AM
Mike S Mike S is offline
Junior Member
 
Join Date: May 2008
Posts: 27
Default

everything stays as aamina said except english description: the expression will be true if checked variable represents decimal number (preceding + or - sign is optional)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl ....how to write it correctly with Perl ?!? viki k Perl 0 05-06-2008 04:40 PM

Your Ad Here

All times are GMT. The time now is 01:24 AM.