This is an interesting result of text conversion rules for prose, not code.
The first argument to the method call, as described above, is "العسكرية", the argument that is displayed (*) on the right side. This longer argument is the input, and the shorter substring displayed on the left is actually a pattern, hence a match.
(*: it is assumed that your browser knows how to render from right to left. If you paste a piece of code into an editor or console that does not support complex text layout support, you will see that it is actually ... although the Arabic language will be broken. )
The trick is that punctuation marks, such as quotation marks and commas, are aimless, so they can display from left to right or from right to left, depending on their environment. The logical order of the fragment:
>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< >> Regex.IsMatch("العسكرية", "العسكري")
(which has another confusing property that the quotation marks that appear around each individual parameter are not really.)
This makes some controversial sense for stretch marks of a readable mixed language, but makes the code very confusing! You can stop this by breaking the mileage of aimless characters with something that has a focus from left to right:
Regex.IsMatch("العسكرية", "العسكري")
This is functionally the same code as the original, but it looks very different. You can view the position of the argument sections when entering the first Latin letter.
source share