Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
Pyrite
Forum Regular
Posts: 769 Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:
Post
by Pyrite » Thu Jun 14, 2007 2:16 am
Can someone help me for a regex that would find:
But assuming the text between the two tags could be anything, and span multiple lines.
stereofrog
Forum Contributor
Posts: 386 Joined: Mon Dec 04, 2006 6:10 am
Post
by stereofrog » Thu Jun 14, 2007 4:02 am
What did you try and what exactly didn't work?
Pyrite
Forum Regular
Posts: 769 Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:
Post
by Pyrite » Thu Jun 14, 2007 4:11 am
Hmm, I don't have my original script, it's at home. But i think it was something like.
I'll post more when I get home from work.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jun 14, 2007 8:02 am
Switch "m" to "s" and add "U"
Pyrite
Forum Regular
Posts: 769 Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:
Post
by Pyrite » Thu Jun 14, 2007 6:21 pm
One of the things I'm trying to fix is I'm doing a job for a company whose phpdoc is incorrect in tons of files. Check this out:
Code: Select all
//*********************************************
/**
* function setPrimaryKeyValue
* <pre>
* Sets the value of the primary key field.
* </pre>
* @param $primaryKey [STRING] new primary key value
* @return [void]
*/
You'll notice the first line either has to end with a period or have a blank docblock line after it (which it has neither), so since the short description can be up to 3 lines long, it grabs the first 3 lines including the first pre tag and puts that as the short description, and then phpdoc gripes about not closing the pre tag. I need to make some kind of pattern that can find this type of goof up and fix it by putting a blank docblock line after the first line of text.
Any suggestions?
Pyrite
Forum Regular
Posts: 769 Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:
Post
by Pyrite » Thu Jun 14, 2007 6:30 pm
Aside from that, you might also notice that their @param is used incorrectly. They use it like:
Code: Select all
@param $parameterName [paramType] Description
But I'm pretty sure it is supposed to be:
Code: Select all
@param paramTypeWithoutBrackets $parameterName Description
Does phpdoc really care or does anyone know. How are you supposed to use valid php data types when php doesn't use data types. lol
Pyrite
Forum Regular
Posts: 769 Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:
Post
by Pyrite » Fri Jun 15, 2007 12:56 pm
feyd wrote: Switch "m" to "s" and add "U"
Thanks feyd, that did the trick! Cheers.
Now I just have to figure out how to make this switcharoo work.