workaround issue 9634
Improve Issue 10220 fix.

Improves pull #1329.

Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=10220
Merge pull request #1334 from denis-sh/improve-Issue-10220-fix

Improve Issue 10220 fix.
Merge pull request #1290 from blackwhale/regex-9634

Workaround issue 9634