Using javascript regex containing '@' in razor
Put the following inside the regEx instead of @:
@('@')
The above will be rendered to a single @.
Your example will become:
/^...otherpart @('@')* ... other part$/
You can add another @
in front of it to escape @@
, try leaving out the quantifer *
. If this doesn't seem to work then add <text></text>
around the function, it tells Razor to not parse the contents. Alternatively you can put Javascript in a separate file to accomplish your needs.
If for some reason you have multiple @@
in your string, place code blocks ahead @:@@