question

yusuf2 avatar image
0 Votes"
yusuf2 asked XingyuZhao-MSFT commented

View Regular Expressions from Right to Left in Visual Studio

How can I view regular expressions from right to left when stored in a string variable in Visual Studio?
as in the image ( second line )

  pattern = "\b(ألف|باء)?(تاء|ثاء)"
  output(Regex.Replace(match.Value, "\b(ألف|باء)?(تاء|ثاء)", "$1"))

98232-regex.png



dotnet-visual-basic
regex.png (9.9 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @yusuf2 ,

How can I view regular expressions from right to left when stored in a string variable in Visual Studio

Take a look at 'RegexOptions.RightToLeft' in Regular Expression Options.


1 Vote 1 ·

Hi @yusuf2 ,
Do you still meet this issue? I am looking forward to seeing your message.

1 Vote 1 ·

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered Viorel-1 edited

According to https://devblogs.microsoft.com/dotnet/visual-studio-2019-net-productivity/#regex-language-support and other sources, try adding a special comment:

 ' language=regex
 pattern = "\b(ألف|باء)?(تاء|ثاء)"


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I mean, in the second line of example, it works correctly.
But when I store a pattern in a string variable is not formatted, the first line

0 Votes 0 ·

Then add the special comment to format the string. See the effect in Visual Studio editor.


1 Vote 1 ·