Can anyone help me by giving an explanatory example of each of the below: [:alnum:] [:alpha:] [:space:] [:xdigit:] [:punct:] [:space:] [:blank:] Thanks
on 2013-02-04 11:26
on 2013-02-04 11:35
On 4 February 2013 20:26, Love U Ruby <lists@ruby-forum.com> wrote: > > [:punct:] > > [:space:] > > [:blank:] > > > Thanks > http://lmgtfy.com/?q=%5B%3Aalnum%3A%5D+%20%5B%3Aal... -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd
on 2013-02-04 11:35
Hi, aren't those names self-explanatory? alnum = alphanumeric = a letter of any alphabet or a digit (a, Щ, 1, ...) space = spaces, tabs, newlines, ... xdigit = hexadecimal digit (a-zA-Z0-9) etc.
on 2013-02-04 11:36
On 4 February 2013 20:29, Matthew Kerwin <matthew@kerwin.net.au> wrote: > > > http://lmgtfy.com/?q=%5B%3Aalnum%3A%5D+%20%5B%3Aal... > > I'm sorry, but I *just* answered another post where my solution detailed the steps I used to *search Google for the answer*, and I know for a fact that this answer can be resolved easily and instantly with a 2 second search. I will try to be more like Matz in future. :$ -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd
on 2013-02-04 11:47
my-ruby: did you even try to google that list? http://ruby-doc.org/core-1.9.3/Regexp.html /[[:alnum:]]/ - Alphabetic and numeric character /[[:alpha:]]/ - Alphabetic character /[[:blank:]]/ - Space or tab /[[:cntrl:]]/ - Control character /[[:digit:]]/ - Digit /[[:graph:]]/ - Non-blank character (excludes spaces, control characters, and similar) /[[:lower:]]/ - Lowercase alphabetical character /[[:print:]]/ - Like [:graph:], but includes the space character /[[:punct:]]/ - Punctuation character /[[:space:]]/ - Whitespace character ([:blank:], newline, carriage return, etc.) /[[:upper:]]/ - Uppercase alphabetical /[[:xdigit:]]/ - Digit allowed in a hexadecimal number (i.e., 0-9a-fA-F)
on 2013-02-04 11:59
Hans Mackowiak wrote in post #1095104: > my-ruby: > did you even try to google that list? > http://ruby-doc.org/core-1.9.3/Regexp.html > > > /[[:alnum:]]/ - Alphabetic and numeric character > /[[:alpha:]]/ - Alphabetic character > /[[:blank:]]/ - Space or tab > /[[:cntrl:]]/ - Control character > /[[:digit:]]/ - Digit I know their description - but would be good for me if I get a ruby tiny code to see their uses. Mainly how syntactically are they used,basically. Thanks
on 2013-02-04 12:11
On Mon, Feb 4, 2013 at 4:59 AM, Love U Ruby <lists@ruby-forum.com> wrote: >> /[[:digit:]]/ - Digit > > I know their description - but would be good for me if I get a ruby tiny > code to see their uses. Mainly how syntactically are they > used,basically. Read the page Hans pointed you to: /[[:upper:]][[:lower:]]/.match("Hello") #=> #<MatchData "He">
on 2013-02-04 12:14
digit for sample can match more than just plain 0-9
# U+06F2 is "EXTENDED ARABIC-INDIC DIGIT TWO"
/[[:digit:]]/.match("\u06F2") #=> #<MatchData "\u{06F2}">
on 2013-02-04 16:36
Hans Mackowiak wrote in post #1095110: > digit for sample can match more than just plain 0-9 > > # U+06F2 is "EXTENDED ARABIC-INDIC DIGIT TWO" > /[[:digit:]]/.match("\u06F2") #=> #<MatchData "\u{06F2}"> Any example for the others as I listed in my description?
on 2013-02-04 16:40
Love U Ruby wrote in post #1095145: > Hans Mackowiak wrote in post #1095110: >> digit for sample can match more than just plain 0-9 >> >> # U+06F2 is "EXTENDED ARABIC-INDIC DIGIT TWO" >> /[[:digit:]]/.match("\u06F2") #=> #<MatchData "\u{06F2}"> > > > Any example for the others as I listed in my description? You now know the syntax, try them in IRB to discover their behaviour.
on 2013-02-04 16:46
tamouse mailing lists wrote in post #1095109: > On Mon, Feb 4, 2013 at 4:59 AM, Love U Ruby <lists@ruby-forum.com> > wrote: >>> /[[:digit:]]/ - Digit >> >> I know their description - but would be good for me if I get a ruby tiny >> code to see their uses. Mainly how syntactically are they >> used,basically. > > Read the page Hans pointed you to: > > /[[:upper:]][[:lower:]]/.match("Hello") #=> #<MatchData "He"> Okay! Could you explain how the matching here performed, to produce "#<MatchData "He">"
on 2013-02-04 17:02
On Mon, Feb 4, 2013 at 7:46 AM, Love U Ruby <lists@ruby-forum.com> wrote: > > > > /[[:upper:]][[:lower:]]/.match("Hello") #=> #<MatchData "He"> > > > Okay! Could you explain how the matching here performed, to produce > "#<MatchData "He">" > > Could you at least at some point take 10 seconds and try to figure anything out on your own? 99.9% of the fun of development is the excitement of figuring something out. If all you are going to do every day is just accomplish nothing then why bother with this path in life? What possibly do you believe would produce that result? What about trying with "hEllo" or "HELLO" or "hello" and see what comes back and see what you can deduce from that. Then move on to something like "HeLlO" and see how it works and what you can do to get multiple results and how to handle multiple results. You are missing so much of the enjoyment of the language by sitting there and accomplishing absolutely nothing on your own.
on 2013-02-04 17:44
On Mon, Feb 4, 2013 at 4:46 PM, Love U Ruby <lists@ruby-forum.com> wrote: >> >> /[[:upper:]][[:lower:]]/.match("Hello") #=> #<MatchData "He"> > > > Okay! Could you explain how the matching here performed, to produce > "#<MatchData "He">" There are tutorials on regular expressions out there on the web. Nobody is going to go through the effort to write another one just for you. If you want a book, read "Mastering Regular Expressions". Cheers robert
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.