Need Grouping of Regular Expression

Muhammad Muazzam

I want to get regex for the following construct where it should result as:

Actions and Sci-Fi

<a href="/?genre=Action">Actions</a> <a href="/?genre=Sci-Fi">Sci-Fi</a>
Avinash Raj

Don't parse html files with regex. If you insist then you could use the below regex and get the text inside anchor tags from group index 1.

<a\s[^<>]*>([^<>]*)<\/a>

DEMO

Explanation:

<a                       '<a'
\s                       whitespace (\n, \r, \t, \f, and " ")
[^<>]*                   any character except: '<', '>' (0 or more
                         times)
>                        '>'
(                        group and capture to \1:
  [^<>]*                   any character except: '<', '>' (0 or
                           more times)
)                        end of \1
<                        '<'
\/                       '/'
a>                       'a>'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Need to know logic behind few regular expression

From Dev

Need a breakdown of the following regular expression

From Dev

Need Regular expression for Validating and Restricting Length of EmailID

From Dev

Need help to create regular expression in Java

From Dev

Python - re - need help for regular expression

From Dev

Need help understanding this particular regular expression [^.]

From Dev

Need for help in this scrapy regular expression

From Dev

Perl String Regular Expression - Need Explanation

From Dev

Extract string with grouping in regular expression on terminal

From Dev

Java Regular Expression; need to map \' to ''

From Dev

Mysql Grouping of data and regular Expression

From Dev

Java Regular Expression : Need Simpler Solution

From Dev

Need a modification in the regular expression

From Dev

Need a regular expression for match a 'url' in 'img' tag

From Dev

Need PHP regular expression

From Dev

Javascript regular expression replacement with grouping

From Dev

Nested grouping Regular Expression in Python

From Dev

Need regular expression expertise

From Dev

Need help for writing regular expression

From Dev

Python Regular Expression Multiple Overlap Grouping

From Dev

Extract string with grouping in regular expression on terminal

From Dev

Regular Expression Grouping

From Dev

Need a modification in the regular expression

From Dev

Need help in this Regular Expression

From Dev

Regular expression grouping with multiple condition

From Dev

Need Number validation regular expression

From Dev

Regular Expression not grouping

From Dev

Regular expression dealing with property address & grouping

From Dev

Need assistance with a regular expression

Related Related

HotTag

Archive