• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to interpret this regex?  RSS feed

 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I have a regex :

Can someone explain to me what it means?

Thank you!
 
author
Sheriff
Posts: 23484
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Volodymyr Levytskyi wrote:
I have a regex :

Can someone explain to me what it means?



Interesting. I am not even sure if this is a valid regex, as I am not sure if the "-" character is allowed in the position that it is in. And if it is allowed, then I am still not sure if it is valid, as there may be an extra "]" remaining. Perhaps, someone better with regular expressions can shine a better light here.


In the meantime, can you tell us what you think that this regex is supposed to do?

Henry
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply!

I need to understand only this part
\p{Thai}

I found this regex here
 
Henry Wong
author
Sheriff
Posts: 23484
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Volodymyr Levytskyi wrote:Thanks for reply!

I need to understand only this part
\p{Thai}

I found this regex here




Oh, I see. The "-" character, in that position, is a subtraction operator. Interesting.

That site also answers your question -- it is a character in the character set of Thai characters.


And BTW, the current Java regex engine does not support the subtraction operator. It also does not support the Thai character set.... so, basically, that regex is invalid when using the current Java regex engine.

Henry
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

Java supports character class subtraction and intersection and union in regex. The syntax is different.
See official tutorial.
 
Henry Wong
author
Sheriff
Posts: 23484
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Volodymyr Levytskyi wrote:
Java supports character class subtraction and intersection and union in regex. The syntax is different.
See official tutorial.




Yeah, I know that -- that is why I explicitly stated "subtraction operator"...

Henry



PS... Interesting topic. Have a cow...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!