Skip to main content
deleted 7 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375

I've found an old MathGroup discussion on this topic from where I learned that StringCases and StringPosition don't have thesupport abbreviated string pattern optionpatterns, and that Verbatim forces StringMatchQ to match two strings literally: StringMatchQ["\\*", Verbatim["\\*"]] returns True.

I've found an old MathGroup discussion on this topic from where I learned that StringCases and StringPosition don't have the abbreviated string pattern option, and that Verbatim forces StringMatchQ to match two strings literally: StringMatchQ["\\*", Verbatim["\\*"]] returns True.

I've found an old MathGroup discussion on this topic from where I learned that StringCases and StringPosition don't support abbreviated string patterns, and that Verbatim forces StringMatchQ to match two strings literally: StringMatchQ["\\*", Verbatim["\\*"]] returns True.

added 413 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375

###Update

I've found an old MathGroup discussion on this topic from where I learned that StringCases and StringPosition don't have the abbreviated string pattern option, and that Verbatim forces StringMatchQ to match two strings literally: StringMatchQ["\\*", Verbatim["\\*"]] returns True.


###Update

I've found an old MathGroup discussion on this topic from where I learned that StringCases and StringPosition don't have the abbreviated string pattern option, and that Verbatim forces StringMatchQ to match two strings literally: StringMatchQ["\\*", Verbatim["\\*"]] returns True.

added 397 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375

Note also that escaping with single backslash is meant for Mathematica's internal metacharacters like < and > (and obviously for more common n, t and r etc. but with another counting by StringLength) as described in this answer by John Fultz:

The following demonstrates a possible bug (for the string "\*" length must be 2 because * isn't an internal metacharacter of Mathematica and it needs not be escaped inside of an ordinary string):

StringLength["*"]
StringLength["\*"]
1
1
StringLength["\x"]

Syntax::stresc: Unknown string escape \x.

2

Note also that escaping with single backslash is meant for Mathematica's internal metacharacters like < and > (and obviously for n, t and r etc. but with another counting) as described in this answer by John Fultz:

Note also that escaping with single backslash is meant for Mathematica's internal metacharacters like < and > (and obviously for more common n, t and r etc. but with another counting by StringLength) as described in this answer by John Fultz:

The following demonstrates a possible bug (for the string "\*" length must be 2 because * isn't an internal metacharacter of Mathematica and it needs not be escaped inside of an ordinary string):

StringLength["*"]
StringLength["\*"]
1
1
StringLength["\x"]

Syntax::stresc: Unknown string escape \x.

2
added 637 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading
added 73 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading
added 51 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading
added 51 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading
added 51 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading
added 932 characters in body
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading
Source Link
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375
Loading