Get characters within regular expression specified characters

Asked 1 years ago, Updated 1 years ago, 73 views

dsfasdfasdf<img src=\"http://localhost:5757/wordpress/wp-content/uploads/anspress-temp/5d16b2028ad608832beca5678fe2aa2e9ffd3596_1.png\" /> asdfasdfasdf

I'd like to find the characters between (src=\") and (\"/>) Regular ceremony is too hardYo;;;

I'd appreciate it if you let me know.

regex

2022-09-22 19:32

2 Answers

It does work like this.

(?<=src=\") (.*?)(?=\")

Test


2022-09-22 19:32

How about getting property values instead of regular expressions?

You can also read it by giving the above tag value an id or name.

document.getElementById("img-id").src

If not, I think there is a way to get the HTml collection and get it under certain conditions as well.

document.getElementsByTagName("img")[0].src


2022-09-22 19:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.