[General boards] [Winter 2019 courses] [Fall 2018 courses] [Summer 2018 courses] [Older or newer terms]

Regex, which characters need \ to show up in string?


. $ ^ ? * +
Is there more characters need a back slash ?


Any character that has more than one meaning requires a backslash. So your list can include all of ( ) { } [ ]


I tried these with an online regex tester and it seems that it can match ] { } literally without a backslash


It depends on how the software is written. Different languages handle regex differently. Also you may have difficulty if you want to match the string “{3}” since it could be interpreted as repeating the thing before it 3 times.

For the purposes of this exam, escape any character that has more than one meaning, if you want it to show up literally in your matching string.


Alright thank you !!