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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -