I have a pure text file without any HTML formatting. I want to search for a word in it? how should i do that? and I also want the next words before a comma. can i do that to?
so means:
if its: "word1":"i like stackoverflow", next thing
i want to find word1 which is in inverted commas and then i want the whole phrase i like stackoverflow without the inverted commas. and it should stop at that point.
is there any way to do that?
thanks…
Use a regular expression. In PHP, you can use a function like
preg_matchto do this.For the pattern you described, your regular expression code could be something like:
The results of the match will then be placed in
$match_array.