Regex Help, anti-query replacement -


how remove lines have 3 or less slashes, retain bigger links?

a. http://two/three/four b. http://two/three c. http://two 

a stay nothing else would.

thanks

search: (?m)^(?:[^/]*/){0,3}[^/]*$

replace: ""

on demo, see how lines 3 or fewer slashes matched. these ones nix.

explain regex

(?m)                     # set flags block (with ^ , $                          # matching start , end of line) (case-                          # sensitive) (with . not matching \n)                          # (matching whitespace , # normally) ^                        # beginning of "line" (?:                      # group, not capture (between 0 , 3                          # times (matching amount                          # possible)):   [^/]*                  #   character except: '/' (0 or more                          #   times (matching amount                          #   possible))   /                      #   '/' ){0,3}                   # end of grouping [^/]*                    # character except: '/' (0 or more times                          # (matching amount possible)) $                        # before optional \n, , end of                          # "line" 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -