I am quite new at Regex and would like to remove the following text:
1/10 2/10 3/10 4/10 5/10 6/10 7/10 8/10 9/10 10/10
I was thinking something like:
/1(.*)10(.*)2(.*)10(.*)3(.*)10(.*)10/s
but this doesnt seem to do the trick, it does remove the text, but it removes some other things too. Some images also contain numbers, so it starts to remove from the number in 开发者_JS百科the image on.
So what i am looking for is to remove the exact text as above only
You have a couple of problems here.
1) You are matching multiple characters with .*
when there's only one character there (either a slash or a space). You could simply use a .
to match a single character.
2) You don't even need to do that. Why not use a literal, escaped slash \/
and space respectively?
If you want to remove that exact text, I suggest using string.Replace instead of using regular expressions... that is if you're using a language with a string replace function.
Thanks for the help! As i mentioned i am new at Regex, so please forgive my teminology.
Anyway i have matched the text with /1.10.2.10.3.10.4.10.5.10.6.10.7.10.8.10.9.10.10.10/
and replaced it with a blank field and that has done the trick!
Thanks for the hints and the support, it is really appreciated!
精彩评论