Skip to content

Instantly share code, notes, and snippets.

@localhost8080
Last active November 15, 2016 16:02
Show Gist options
  • Save localhost8080/4c602693759fee6c03a29873b13b82c9 to your computer and use it in GitHub Desktop.
Save localhost8080/4c602693759fee6c03a29873b13b82c9 to your computer and use it in GitHub Desktop.
#!/bin/sh
# find <? with any whitespace
ack -o --nogroup --break --php "<\?\s" *
# find <?}
ack -o --nogroup --break --php "<\?}" *
# find <?echo
ack -o --nogroup --break --php "<\?echo" *
# find all three above in one command
ack -o --nogroup --break --php "(<\?\s)|(<\?})|(<\?echo)" *
# find all <? tags that are followed by whitespace or <? and not followed by php or = or x
ack -o --nogroup --break --php "(<\?\s)|(<\?})|(<\?echo)|(<\?[^p=x])" *
# a better regex that gets them all:
ack -o --nogroup --break --php '<\?(?!php|=|x)' *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment