Home > Web Front-end > HTML Tutorial > Regular expression for deleting hyperlinks in HTML in batches_html/css_WEB-ITnose

Regular expression for deleting hyperlinks in HTML in batches_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:58:57
Original
1358 people have browsed it

I want to use UEStudio to delete hyperlinks in an HTML file in batches. I want to write a regular expression. I don’t know how to write the regular expression?
Expression rules: (I can understand it, but I don’t know how to use it...)
Regular expression (UltraEdit syntax):

Symbol
Function

%
Match start of line ? means that the search string must be at the beginning of the line, but does not include any line-terminating characters in the selected result characters.

$
Match end of line ? Indicates that the search string must be at the end of the line, but does not include any line-terminating characters in the selected result characters.

?
matches any character except newline.

*
Matches any number of characters that appear except newlines.


Matches one or more preceding characters/expressions. At least one occurrence of the character must be found. Does not match repeated newlines.


Matches the preceding character/expression 0 or more times. Does not match repeated newlines.

^b
Matches a page break.

^p
Matches a newline character (CR/LF) (paragraph) (DOS file)

^r
Matches a newline character (CR only) (paragraph) ( MAC files)

^n
Matches a newline (LF only) (paragraph) (UNIX files)

^t
Matches a tab

[ ]
Matches any single character or range within brackets

^{A^}^{B^}
Matches the expression A or B

^
Ignore the following regular expression characters

^(*^)
Add parentheses or labels to the expression to use in the replacement command. There can be 9 expression tags in a regular expression, and the numbers are determined based on their order in the regular expression.

The corresponding replacement expression is ^x, and the range of x is 1-9. For example: If ^(h*o^) ^(f*s^) matches "hello folks", then ^2 ^1 means that it will be replaced with "folks hello".



Note? ^ The character "^" involved here is not a control key value.

For example:

m?n matches "man", "men", "min", but not "moon".

t*t matches the "tea t" part of "test", "tonight" and "tea time", but does not match "tea

time" ("tea" and "time" ” with a newline between them).

Test matches "test", "teest", "teeeest", etc., but does not match "tst".

[aeiou] matches each lowercase vowel letter

[,.?] matches the text ",", "." or "?".

[0-9a-z] matches any number or lowercase letter

[~0-9] matches any character except numbers (~ means not matching the content after it)


Reply to discussion (solution)

]*>

Try the above, delete the link tag

If you want to delete elements, you can try removeChild.

Pattern p = Pattern.compile("]*> ;");
Matcher m = p.matcher(allContent);
allContent = m.replaceAll("");

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template