2

I am new to regex,

Can anyone explain for me the patterns:

(<form[^\a]*</form>|<FORM[^\a]*</FORM>)
(method="[a-zA-Z]*|METHOD="[a-zA-Z]*)
Vendetta
  • 151

2 Answers2

1

Two great resources for RegExp: Debugexx and regular expressions 101

(<form[^\a]*</form>|<FORM[^\a]*</FORM>)

Regular expression visualization

Debuggex

enter image description here

regular expressions 101


(method="[a-zA-Z]*|METHOD="[a-zA-Z]*)

Regular expression visualization

Debuggex

enter image description here

regular expressions 101

A.B.
  • 90,397
0

From https://myregextester.com/index.php# (enter pattern in the field Match pattern and make sure you have ticked Explain. then click Submit):

----------------------------------------------------------------------
  (                        group and capture to \1:
----------------------------------------------------------------------
    <form                    '<form'
----------------------------------------------------------------------
    [^\a]*                   any character except: '\a' (alarm) (0 or
                             more times (matching the most amount
                             possible))
----------------------------------------------------------------------
    </form>                  '</form>'
----------------------------------------------------------------------
   |                        OR
----------------------------------------------------------------------
    <FORM                    '<FORM'
----------------------------------------------------------------------
    [^\a]*                   any character except: '\a' (alarm) (0 or
                             more times (matching the most amount
                             possible))
----------------------------------------------------------------------
    </FORM>                  '</FORM>'
----------------------------------------------------------------------
  )                        end of \1
----------------------------------------------------------------------
                           '\r\n'
----------------------------------------------------------------------
  (                        group and capture to \2:
----------------------------------------------------------------------
    method="                 'method="'
----------------------------------------------------------------------
    [a-zA-Z]*                any character of: 'a' to 'z', 'A' to 'Z'
                             (0 or more times (matching the most
                             amount possible))
----------------------------------------------------------------------
   |                        OR
----------------------------------------------------------------------
    METHOD="                 'METHOD="'
----------------------------------------------------------------------
    [a-zA-Z]*                any character of: 'a' to 'z', 'A' to 'Z'
                             (0 or more times (matching the most
                             amount possible))
----------------------------------------------------------------------
  )                        end of \2
----------------------------------------------------------------------
                           '\r\n'
----------------------------------------------------------------------
)                        end of grouping
----------------------------------------------------------------------
Byte Commander
  • 107,489
  • any character except: '\a' (alarm) (except a how ?? how can be (a) letter in form) ? – Vendetta Nov 20 '15 at 14:25
  • i mean
    something like that there's a in "name" ?? it means except this a ??
    – Vendetta Nov 20 '15 at 14:28
  • The pattern [^\a]* gets evaluated and means that it matches a character different from the special character \a which is usually not printable but some kind of control character. Therefore that does not make much sense to me either. And the * means that this part may appear 0 times, once or any other number. – Byte Commander Nov 20 '15 at 14:31