S
S
Sergey Berezovsky2018-03-23 12:39:40
Java
Sergey Berezovsky, 2018-03-23 12:39:40

How to write some regular expression in Java?

There is this line:

String line = "<p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'><img width=165 height=128 src=image001.jpg/></p>"

I need to find out if there is an img tag in it and output it to the console, that is, this part.
<img ..(то что у нас внутри тега не важно).. />
I tried to write a regular expression, but it looks like this:
<img ..(то что у нас внутри тега не важно)../></p>
Here is my pattern:
// Так же у нас этот тег может не иметь в конце косой черты, т.е <img ..(то что у нас внутри тега не важно)..>
Pattern p2 = Pattern.compile("<img.+((\\/>)|>)");

Help me write the correct regular expression!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2018-03-23
@SergeyBerezovsky

tyts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question