Skip to main content
edited tags
Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Tweeted twitter.com/StackMma/status/939046517364572160
Source Link

String matching problem/bug

I expected this code below to evaluate to True (it does evaluate to False):

StringMatchQ["«TITLE:Load(1,2)»",
 (StartOfString ~~ "«" ~~ prop__ ~~ ":Load»" ~~ EndOfString) |
 (StartOfString ~~ "«" ~~ prop__ ~~ ":Load(" ~~ params___ ~~ ")»" ~~ 
EndOfString)]

Especially since this simpler one does indeed evaluate to True:

StringMatchQ["«TITLE:Load(1,2)»",
 ("JUST A RANDOM STRING WHICH IS NOT MATCHED ANYWAY")|
  (StartOfString ~~ "«" ~~ prop__ ~~ ":Load(" ~~ params___ ~~ ")»" ~~ 
    EndOfString)]

Have I just found a bug or am I missing some subtlety?