开发者

Regex Patterns in Java

开发者 https://www.devze.com 2023-01-29 19:20 出处:网络
I am using Regex Patterns and I need to check that the beginning of the String is an HTML Simple Text and return that String.So for example:

I am using Regex Patterns and I need to check that the beginning of the String is an HTML Simple Text and return that String. So for example:

Hello World!<TAG> &nsbp;

Shoul开发者_运维技巧d return:

Hello World!


Remember that if you're parsing large sections of text or entire files, you should force the String into a new reference otherwise you may get a memory leak due to substrings.

new String("Hello World!<TAG> &nsbp;".split("<")[0])


"Hello World!<TAG> &nsbp;".split("<")[0]

should return Hello World!.

0

精彩评论

暂无评论...
验证码 换一张
取 消