Search This Blog

Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts

Tuesday, August 11, 2020

Password validator

 Validating password with python.


Regex

import re

passRX = re.compile(r'[A-Za-z0-9@#$%^&+=]{8,}')

pp = passRX.search('dy_5mupV')

pp == None

True


pp = passRX.search('DEVGukvk')

pp == None

False


Reference:

Wednesday, May 30, 2018

Using regex in vim

Search and replace using quantifiers.

Example:
This will erase all checkID's with single and/or double digits.

:%s/"checkID":[0-9]\{1,2\} //g

Before






Running command.



Tuesday, April 14, 2015

Match IP numbers with regex.


Print any IP address talking on port 21 in coming or out going.
Change the port number to any port that needs to be matched.

netstat -na | perl -ne '/((\d{1,3}\.){4}21)/ &&  print ;'