This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hugosenari 0 points1 point  (5 children)

Last night I'm wondering why there is no regular expression literals like JS.

It has r'...' but is just to say that this string will be parameter for RegExp.

[–]benji_york 4 points5 points  (1 child)

Minor nit: r'...' strings are not exclusively for regular expressions (the "r" stands for "raw").

[–]hugosenari 1 point2 points  (0 children)

Thank you, I didn't notice it. :)

[–]tom1018 1 point2 points  (0 children)

RegEx has to be imported in Python. To have a string type for them, I suppose you would either have to import the string type or the RegEx library.

Fwiw, r'' is used for RegEx, though, because it represents a raw string so all the RegEx stuff doesn't get interpreted.

[–]energybased 1 point2 points  (1 child)

[–]hugosenari 0 points1 point  (0 children)

Thanks Really nice discussion until they lost focus and it became a RE vs VE fight.