grep - Match code of concatenated strings with regex -


i need regex matches code fragments like:

'lo'.'re'.'m'.' ipsum'.' dol'.'or'

i've no idea how start. how if know final string lorem ipsum dolor don't know positions or amount of '.'?

i'm trying find string in source files grep on command line. in code can example like.

$random = 'lo'.'re'.'m'.' ipsum'.' dol'.'or'; 

you can use tr:

s="'lo'.'re'.'m'.' ipsum'.' dol'.'or'" echo "$s" | tr -d "[.']" lorem ipsum dolor 

to validate grep:

echo "$s" | tr -d "[.']" | grep -q 'lorem ipsum dolor' echo $? 0 

Comments

Popular posts from this blog

mysqli - Php Mysqli_fetch_assoc Error : "Warning: Illegal string offset 'name' in" -

html - Cut text on left side inside button while centering -

php - Hide Categories from WordPress Dashboard by ID and Custom Post Type -