Jump to content

Regular expression questions

- - - - -

  • Please log in to reply
4 replies to this topic

#1
onething

onething

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
Why does [$\u20AC] match a dollar or euro sign?

Regexp Tutorial - Character Classes or Character Sets

According to that page?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
That's the unicode character.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
The Euro symbol is very hard to ensure representation of in an ASCII-like codepage, so the tutorial defaults to matching the Unicode codepoint of the Euro character, as it was very likely stored as one.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts
\u is the escape sequence for a Unicode character. Unicode is a 24-bit character set that allows for a wider range of symbols than ASCII. The Euro sign would be a Unicode character since it's not found in ASCII or (to my knowledge) Extended ASCII, and is evidently represented by \u20AC.
Programming is a journey, not a destination.

#5
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200

Quote

Unicode is a 24-bit character set
The Unicode text format standards can range from 5-32 bits and anything inbetween really.
A nice review if it is of interest to you: Comparison of Unicode encodings - Wikipedia, the free encyclopedia
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users