firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.26k stars 199 forks source link

.NET (C#) Issue with double quotes #2085

Closed dembeck closed 1 year ago

dembeck commented 1 year ago

Bug Description

When I try to add a double quote '"' to a regex pattern it gives one of two errors.

Reproduction steps

Double Quote

Escaped Double Quote

PowerShell Escaped Double Quote

Expected Outcome

That it handles double quotes correctly.

Browser

Microsoft Edge Version 114.0.1823.51 (Official build) (64-bit)

OS

Windows 11 23H2 Build 25375 Also have the issue on my Mac

working-name commented 1 year ago

Hi @dembeck

TL;DR: use "" to escape a double quote in a raw .NET string aka @"..."

1968 #1842 #1859