You are viewing limited content. For full access, please sign in.

Question

Question

Pattern Match

asked on August 3, 2016 Show version history

Need to match a sample like,

"1234-1234-1234-12.pdf   or

12341234123412 (3)

and extract only the first 14 digits. 

I was thinking something like ^(\d{14})$ but that doesnt work. 

Thanks in advance!

0 0

Answer

SELECTED ANSWER
replied on August 3, 2016

You need to account for the dashes. So something like \d{4}-?\d{4}-?\d{4}-?\d{2} should do it.

1 0
replied on August 3, 2016

Thanks Miruna that works perfect!

 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.