Introduced in 10.1, fixed in 10.2; fixed via paclet update in 10.1.

The new version 10.1 has introduced some strange (possibly buggy) behaviour compared to v10.0:

StringCases["1472", Except["0", DigitCharacter]]
(* v10.0 *) {"1","4","7","2"}
(* v10.1 *) {"1"}

Since StringCases["1472", DigitCharacter] returns {"1","4","7","2"} (all the characters) I would expect the same for an Except[char] pattern.

StringCases["1472", Except["0", DigitCharacter] ~~ "0" ... ~~ EndOfString]
(* v10.0 *) {"2"}
(* v10.1 *) {}

Further examples (thanks to Michael Hale):

StringReplace["1a2b3c4", Except["a", LetterCharacter] .. -> ""] (* ==> "1a2b3c4" *)

though even the documentation of Except says it should be: "1a234" (this should be the correct output).

StringCases["104702", Except["0", DigitCharacter]] (* ==> {"1", "4", "2"} *)

Furthermore, ToTitleCase removes all non-alphanumeric characters (except whitespace):

ToTitleCase["abcd,<>/-_=+~!@#$%&*(){}[];': end...?"] (* ==> "Abcd End" *)

which is probably unwanted and is definitely undocumented.

(Filed it to TechSupport, will report back if they say anything.)

2015-07-29: ToTitleCase is not available anymore in version 10.2 (it was experimental).

  • 42
    $\begingroup$ We needed a 10.0.3 with more bug fixes, not a 10.1 with new bugs! >:-@ $\endgroup$
    – Mr.Wizard
    Commented Apr 2, 2015 at 14:31
  • 3
    $\begingroup$ StringPattern`PatternConvert[Except["0", DigitCharacter]] gives a different result in 10.1.0. This is the place to look to find out why it happens. I don't have time to look up all the various bits needed to understand what the actual regexes do ... $\endgroup$
    – Szabolcs
    Commented Apr 2, 2015 at 14:33
  • 4
    $\begingroup$ @Szabolcs In 10.1.0 we upgraded the PCRE library used for much of the string pattern matching. This must have slipped through. Reported internally. $\endgroup$
    – Stefan R
    Commented Apr 2, 2015 at 16:19
  • 9
    $\begingroup$ @Daniel (1) I sincerely apologize for any connotation of devaluing the work of you and your colleagues. Nevertheless it seems to me that from the top down there is a misplaced emphasis on new features over making existing ones work properly (fast and bug-free). 10.0.2 still feels a lot like a beta release; a 10.0.3 with the 10.1.0 bug fixes would be highly appreciated but I don't expect it will happen. If I can get that message across to Dr. Wolfram then my comment will have served its purpose. And I'll point out that my comment is attracting quite a few votes of agreement. $\endgroup$
    – Mr.Wizard
    Commented Apr 3, 2015 at 18:41
  • 10
    $\begingroup$ @Daniel (2) Perhaps some day the directorial emphasis will change and the copious talents of you and your team will be brought to bear on aspects of the product that are more important to me, and as I perceive many like me. $\endgroup$
    – Mr.Wizard
    Commented Apr 3, 2015 at 18:43

2 Answers 2


This is a bug in version 10.1.0. We decided it was serious enough to warrant a fix via an automatic paclet update. The paclet has been pushed live and Mathematica should install it automatically once it does a periodic check with the paclet server. It should take about a week or so.

To install it right away, you can do PacletInstall["StringPatternFix"]. You may need to restart the kernel for the fix to take effect, but after that it should work in all subsequent kernel sessions automatically.

  • 2
    $\begingroup$ I get this when I try it. Perhaps it just takes a bit longer? $\endgroup$
    – Szabolcs
    Commented Apr 6, 2015 at 23:00
  • $\begingroup$ @Szabolcs Hmm... Does doing PacletSiteUpdate /@ PacletSites[] help? $\endgroup$
    – Stefan R
    Commented Apr 7, 2015 at 15:11
  • 1
    $\begingroup$ It worked today, without PacletSiteUpdate. $\endgroup$
    – Szabolcs
    Commented Apr 7, 2015 at 15:18
  • 2
    $\begingroup$ Works now. :) Thank you! $\endgroup$
    – Jinxed
    Commented Apr 7, 2015 at 17:44
  • 3
    $\begingroup$ @Szabolcs It was deliberately removed. This is what our lead FE developer had to say about it: "[Why did I remove it]: Because it's an antiquity that is almost completely useless (and for those for whom it's not useless, I left the key binding). Question...why is interrupting useful? (a) If you wanted to abort, you'd just abort. (b) If you want to continue, then why did you interrupt in the first place? (c) If you wanted to check status, you could use any number of modern features, including Evaluate in Subsession, Monitor, PrintTemporary, etc. " $\endgroup$
    – Stefan R
    Commented Apr 10, 2015 at 20:21

Workaround for the two-argument Except in string patterns issue until it is fixed:

StringCases["104702", DigitCharacter?(! StringMatchQ[#, "0"] &)]

Match the second argument directly, then use PatternTest to check that it also doesn't match the first argument.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.