Problem with regex last X chars, but "\" gives error

Viewed 8

I created a simple regex, which should select the last.

18 chars from this string.

\\oe-file02\H\01-Products\001-Disc-PED\047-Stator-parts-3000\adc-047-101-01.ipt

To do this i am using.

re.findall('(.{17})$', str("\\oe-file02\H\01-Products\001-Disc-PED\047-Stator-parts-3000\adc-047-101-01.ipt").strip('\''))

When i select 17.

My output is:

['dc-047-101-01.ipt']

But whenever i select 18, and uses the same method, my output becomes.

['\x07dc-047-101-01.ipt']

Which is not right, i dont know if its the "\" that are doing something funky, but it should be a char since its in a string, i cant see why it would cause any any problems.

Could anyone help me out?

0 Answers
Related