Legend
Legend

Reputation: 116820

Regex for the dot character?

I am trying to detect a 'bullet' character followed by some text. For example:

• This is some text here

Can someone tell me what is the regex to detect the 'bullet' character in python? What is this symbol?

Upvotes: 0

Views: 694

Answers (2)

eyquem
eyquem

Reputation: 27575

Well, a dot is a special character in a regex pattern. So if you want to sepcify a dot you need to escape the special charactr dot like that:

import re

regx = re.compile('\.ab..')

ss = ',ab123  .ab4578  !ab1298   .abUVMO'

print regx.findall(ss)

# result:  ['.ab45', '.abUV']

Upvotes: -2

Fred Foo
Fred Foo

Reputation: 363587

It's just , but you may have to do a little dance to get it in your source file.

# -*- coding: utf-8 -*-
pattern = re.compile(ur'•')

Upvotes: 6

Related Questions