Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

StringRegExp with /b and /b (unicode support):How to switch it on?


  • Please log in to reply
15 replies to this topic

#1 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 26 December 2007 - 12:17 AM

Hi,

little example shows up what I mean. :)

$text = "I try ü ä ö working with 'Text' Wordtext" If _checkWord($text, "'Text'") Then MsgBox(0, "", "'Text' found") If _checkWord($text, "Text") Then MsgBox(0, "", "Text found") If _checkWord($text, 'ü') Then MsgBox(0, "", "ü found") If _checkWord($text, 'ä') Then MsgBox(0, "", "ä found") If _checkWord($text, 'ö') Then MsgBox(0, "", "ü found") Func _checkWord($string, $word)     If StringRegExp($string, '\b' & $word & '\b', 0) Then Return 1     Return 0 EndFunc   ;==>_checkWord


In Regexbuddy it works that way!

So long,

Mega

Edited by Xenobiologist, 26 December 2007 - 03:36 PM.

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times








#2 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 26 December 2007 - 12:56 AM

In Regexbuddy it works that way!

What way? I don't know what you expect and what you don't expect. Are all those conditions supposed to return true? Are they all supposed to return false?

#3 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 26 December 2007 - 11:42 AM

What way? I don't know what you expect and what you don't expect. Are all those conditions supposed to return true? Are they all supposed to return false?


Hi,

:) of course not. Only the second call of _checkWord returns true. I expected that the third, fourth and fifth call also return true. (As they do in RegexBuddy.

I and wondered why it doesn't work with the first one, but this is another question. :P

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#4 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,772 posts

Posted 26 December 2007 - 01:41 PM

Hi,

:) of course not. Only the second call of _checkWord returns true. I expected that the third, fourth and fifth call also return true. (As they do in RegexBuddy.

I and wondered why it doesn't work with the first one, but this is another question. :P

So long,

Mega

Full doc say

In UTF-8 mode, characters with values greater than 128 never match \d, \s, or \w, and always match \D, \S, and \W. This is true even when Unicode character property support is available. These sequences retain their original meanings from before UTF-8 support was available, mainly for efficiency reasons.

So I assume that the reason for all the 'non' matching

#5 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 26 December 2007 - 02:07 PM

Full doc say
So I assume that the reason for all the 'non' matching


Hi,

okay that seems to be the reason, but what is the solution?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#6 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,772 posts

Posted 26 December 2007 - 02:11 PM

Hi,

okay that seems to be the reason, but what is the solution?

So long,

Mega

no idea stringregexp is supposed to support UNICODE so (?i) "case insensitive" must do something

#7 Bowmore

Bowmore

    Feinschmecker

  • Active Members
  • PipPipPipPipPipPip
  • 834 posts

Posted 26 December 2007 - 02:18 PM

[quote name='Xenobiologist' post='453861' date='Dec 26 2007, 12:17 AM']Hi,

little example shows up what I mean. :)

$text = "I try ü ä ö working with 'Text' Wordtext" If _checkWord($text, "'Text'") Then MsgBox(0, "", "'Text' found") If _checkWord($text, "Text") Then MsgBox(0, "", "Text found") If _checkWord($text, 'ü') Then MsgBox(0, "", "ü found") If _checkWord($text, 'ä') Then MsgBox(0, "", "ä found") If _checkWord($text, 'ö') Then MsgBox(0, "", "ü found") Func _checkWord($string, $word)     If StringRegExp($string, '\b' & $word & '\b', 0) Then Return 1     Return 0 EndFunc   ;==>_checkWord

Edited by Bowmore, 26 December 2007 - 03:25 PM.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

#8 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 26 December 2007 - 02:51 PM

Hi,

okay that works a bit better.
My reference is RegexBuddy and trying \b'Text'\b as a pattern doesn't match. In your func it matches.
So, there is still a difference.

Lets see whether somebody knows how to switch on unicode support.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#9 Bowmore

Bowmore

    Feinschmecker

  • Active Members
  • PipPipPipPipPipPip
  • 834 posts

Posted 26 December 2007 - 03:24 PM

Hi,

okay that works a bit better.
My reference is RegexBuddy and trying \b'Text'\b as a pattern doesn't match. In your func it matches.
So, there is still a difference.

Lets see whether somebody knows how to switch on unicode support.

So long,

Mega

I've just done a bit more testing and my script does not work it only appears to work due to my mistake. (?!\\p{L}) should be (?!\p{L}) and when changed to the correct value it does not work
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

#10 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,772 posts

Posted 28 December 2007 - 03:37 PM

I check with Jon which answer that char >128 and unicode cannot have an insensitive handling.
NO FIX as the detailed doc is also saying that

#11 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 28 December 2007 - 05:18 PM

I check with Jon which answer that char >128 and unicode cannot have an insensitive handling.
NO FIX as the detailed doc is also saying that


Hi,

thanks, but sorry I don't understand what you are saying there. Jon told you that chars > 128 cannot be used for \b and so on? :)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#12 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,772 posts

Posted 28 December 2007 - 05:23 PM

Hi,

thanks, but sorry I don't understand what you are saying there. Jon told you that chars > 128 cannot be used for \b and so on? :)

So long,

Mega

it say as the doc say that \b will not match char>128. I was adding that the caseless will not work either. (?i) will not solve anything

#13 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 28 December 2007 - 05:33 PM

it say as the doc say that \b will not match char>128. I was adding that the caseless will not work either. (?i) will not solve anything


Hi,

so then this is no bug. It is a feature request :-)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#14 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,772 posts

Posted 28 December 2007 - 10:31 PM

Hi,

so then this is no bug. It is a feature request :-)

So long,

Mega

it looks like a restriction with the pcre.lib we are using (freeware)
I don't know if we can go around. I leave Jon to directly answer

#15 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,856 posts

Posted 04 January 2008 - 02:22 PM

it looks like a restriction with the pcre.lib we are using (freeware)
I don't know if we can go around. I leave Jon to directly answer


HI,

okay, Jon can we go around? :)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#16 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 04 January 2008 - 02:42 PM

HI,

okay, Jon can we go around? :)

So long,

Mega


It's a bug in pcre - i don't know how to workaround it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users