AmirAli
AmirAli

Reputation: 7

Regex Match word even it contains some char[dash,dot,..]

im trying to build a regex that find strings like

member.php?1078959-AmirAli
member.php?1078959-Amir-Ali
member.php?1078959-Amir-Al-i
member.php?1078959-Amir.Ali
member.php?1078959-Amir_Ali
member.php?1078959-Amir____Ali

i tried to make one : Regex: member.php\?\d{1,30}\-(\w+)

But here is the problem , this regex cant support characters like [ - , . ]

Upvotes: 0

Views: 226

Answers (1)

smead
smead

Reputation: 1808

You can use the [ ] brackets to match any of a set of characters. Also, you forgot to escape the . in member.php

member\.php\?\d{1,30}\-([\w\,\-\.]+)

Upvotes: 2

Related Questions