Jump to content

[SOLVED] Quick Explanation


WorldDrknss

Recommended Posts

I am fairly new to regex and need some help deciphering the following:

eregi("<[^>]*script*\"?[^>]*>", $check_url)

 

If I am correct this will check the url for:

find a: <

find any string containing zero or more: > at the beginning of the line

find any string containing zero or more: script

find any string containing zero or one: "

find any string containing zero or more: > at the beginning of the line

find a: >

 

Link to comment
https://forums.phpfreaks.com/topic/57677-solved-quick-explanation/
Share on other sites

The regular expression:

(?-imsx:<[^>]*script*"?[^>]*>)

matches as follows:
  
NODE                     EXPLANATION
----------------------------------------------------------------------
(?-imsx:                 group, but do not capture (case-sensitive)
                         (with ^ and $ matching normally) (with . not
                         matching \n) (matching whitespace and #
                         normally):
----------------------------------------------------------------------
  <                        '<'
----------------------------------------------------------------------
  [^>]*                    any character except: '>' (0 or more times
                           (matching the most amount possible))
----------------------------------------------------------------------
  scrip                    'scrip'
----------------------------------------------------------------------
  t*                       't' (0 or more times (matching the most
                           amount possible))
----------------------------------------------------------------------
  "?                       '"' (optional (matching the most amount
                           possible))
----------------------------------------------------------------------
  [^>]*                    any character except: '>' (0 or more times
                           (matching the most amount possible))
----------------------------------------------------------------------
  >                        '>'
----------------------------------------------------------------------
)                        end of grouping
----------------------------------------------------------------------

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.