Search found 13 matches
- Wed Oct 11, 2006 11:57 pm
- Forum: PHP - Code
- Topic: Sorting an array alphabetically, human-style
- Replies: 5
- Views: 695
Sorting an array alphabetically, human-style
I have some code that pulls records from a mySQL database and displays them in alphabetical order. This works just fine as far as a computer is concerned, but to a human the results look out of whack. For example, take these four arbitrary phrases: Lois Lane Superman Robots Superman, Man of Steel Th...
- Wed Feb 08, 2006 1:56 pm
- Forum: Regex
- Topic: Ignoring spaces and punctuation
- Replies: 2
- Views: 2191
Ignoring spaces and punctuation
I'm looking for a way to have my regex account for variations in spacing/punctuation. For example, if I'm looking for "gradepoint", I would want "gradepoint", "grade point", "grade-point", "gr.ade-po!i?nt." etc. all to match. (Please note that this i...
- Wed Feb 08, 2006 1:35 pm
- Forum: Regex
- Topic: Case-insensitive, lookaround, variable replacement!
- Replies: 6
- Views: 2941
- Tue Feb 07, 2006 10:55 pm
- Forum: Regex
- Topic: Case-insensitive, lookaround, variable replacement!
- Replies: 6
- Views: 2941
To give the background, this code will be used to search messages posted to my trading card game forums, and turn all card titles (a few thousand possibilities, the full list is pulled from a database) into links to that card's image and text. In the code I'm currently using, the line that does the ...
- Tue Feb 07, 2006 9:49 pm
- Forum: Regex
- Topic: Case-insensitive, lookaround, variable replacement!
- Replies: 6
- Views: 2941
Case-insensitive, lookaround, variable replacement!
I need to look take a long text string and replace certain smaller strings within it. Specific requirements: 1) The strings to match need to be passed as variables. 2) Matches should look ahead (and behind) to non-alphabetical characters. (The point being to prevent matches within a word -- e.g., I ...
- Tue Feb 07, 2006 6:53 pm
- Forum: PHP - Code
- Topic: Manipulating arrays and mySQL query results
- Replies: 2
- Views: 329
Manipulating arrays and mySQL query results
I need to fetch the contents (text stings) of a mySQL database table, stripping the tags from each text string, and putting them in order of descending length. For example, if my database contains: XXXXX <b>YYYY</b> ZZZZZZZZZ Then I would get this array: ZZZZZZZZZ XXXXX YYYY The code I'm using now i...
- Sun Feb 05, 2006 12:23 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
- Sun Feb 05, 2006 12:19 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
- Sat Feb 04, 2006 10:48 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
I think I might actually go back to the idea of doing the replacement when the article is submitted. Having a few older articles that aren't properly linked (or having to resubmit them) seems the least of the available evils. :lol: Will definitely have to store the raw text somewhere when I make tha...
- Sat Feb 04, 2006 9:44 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
I think I'd prefer to keep this an automatic thing, and to have it happen immediately so that people see the linked version right after it's posted -- but I will definitely keep those other ideas in mind, thanks! I now have the DB query sorting cardnames by length, but that doesn't completely solve ...
- Sat Feb 04, 2006 6:22 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
- Fri Feb 03, 2006 5:17 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
Good idea, although in my particular case that would also create maintenance issues. I've got the parse time down to 1 second, which seems reasonable. Still struggling with the overlapping name problem though. The simplest fix I can think of is to check names from longest to shortest, and to check o...
- Fri Feb 03, 2006 1:57 pm
- Forum: PHP - Code
- Topic: Turning certain phrases in a block of text into links!
- Replies: 12
- Views: 865
Turning certain phrases in a block of text into links!
I run a website selling trading card games (Magic: The Gathering, Lord of the Rings TCG, etc.), and recently added a strategy section to the site where people can post their deck ideas and such. I would like to set my strategy section up so that all card names display as links to the detail page for...