Paulo Barros
Paulo Barros

Reputation: 2770

python regular expression

whats the regular expression in python for any string without the char '/'. Thanks

Upvotes: 0

Views: 212

Answers (2)

Matt Ball
Matt Ball

Reputation: 360046

I don't know python's flavor of regex, but I can only imagine it would look something like this:

^[^/]*$

Upvotes: 3

yan
yan

Reputation: 20992

No need for regular expressions

>>> s = 'asdf'
>>> '/' in s
False
>>> s = 'asd/asdf'
>>> '/' in s
True

Upvotes: 8

Related Questions