Skip to content

Instantly share code, notes, and snippets.

@m-ostadi
Created July 1, 2022 13:43
Show Gist options
  • Save m-ostadi/489408713b60561a2f3e92acb1c0c191 to your computer and use it in GitHub Desktop.
Save m-ostadi/489408713b60561a2f3e92acb1c0c191 to your computer and use it in GitHub Desktop.
regex for adding tailwind prefix to existing tailwind classes
in your editor (i used phpstorm ctrl+shift+f for find and replace in all files of a specific folder):
find : (?<=class=["'][^"']*)([0-9a-zA-Z_-]+\s*)(?=[^"']*["'])
replace : tw-$1
@AmagiDDmxh
Copy link

AmagiDDmxh commented Jul 20, 2023

when dealing with [] props
use this

(?<=className=["'][^"']*)([\[\]#0-9a-zA-Z_-]+\s*)(?=[^"']*["'])

adding props like /90

(?<=className=["'][^"']*)([\[\]\/#0-9a-zA-Z_-]+\s*)(?=[^"']*["'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment