Regular Expression to get the SRC of images in C#

后端 未结 8 1512
情深已故
情深已故 2020-11-29 09:34

I\'m looking for a regular expression to isolate the src value of an img. (I know that this is not the best way to do this but this is what I have to do in this case)

相关标签:
8条回答
  • 2020-11-29 09:50

    you can also use a look behind to do it without needing to pull out a group

    (?<=<img.*?src=")[^"]*
    

    remember to escape the quotes if needed

    0 讨论(0)
  • 2020-11-29 09:56

    The regex you want should be along the lines of:

    (<img.*?src="([^"])".*?>)
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题