bcr
bcr

Reputation: 1328

Regex undesireably removing substring

I'm trying to extract void <init>(java.lang.String) and java.io.File getOutputMediaFileUri(int) from the string below (and strings like it).

specialinvoke $r1.<java.io.File: void <init>(java.lang.String)>($r16)@<com.jpgextractor.PicViewerActivity: java.io.File getOutputMediaFileUri(int)>

Currently, I'm matching to the regex:

/.*<.* (\S+ .*)>.*<.* (\S+ .*)>.*/

Which works, except for instead of void <init>(java.lang.String) I just get void (java.lang.String).

I'm a bit mistified where <init> has gone off too...I've tried several different ways to coax it back, but so far no luck.

Thanks folks!

Upvotes: 1

Views: 68

Answers (1)

bcr
bcr

Reputation: 1328

The issue was nothing to do with the regex; as pointed out by acdcjunior and nhahtdh, the regex was operating correctly, but the issue was in displaying the text. I was putting the output void <init>() into a web page as unescaped HTML, where <init> was interpreted as an HTML tag; the <> characters should be escaped.

See Fastest method to escape HTML tags as HTML entities? for information on escaping such tags.

Upvotes: 1

Related Questions