effigy
-
Posts
3,600 -
Joined
-
Last visited
Never
Posts posted by effigy
-
-
I think democracy and capitalism/free enterprise are decent concepts by themselves, but putting them together seems to be a bad idea, as they seem to corrupt each other.
It's a catch-22.
Agreed on both points.
How are Denmark's politics in comparison?
-
Daniel:
I see your point; however, how many people:
- bother looking outside of the Democrat/Republican realm
- are aware that there are more (realistic) choices prior to seeing the ballot
- do not rely solely on the TV for getting their information
Frankly, many of the people I've encountered know next to nothing about other parties (myself often included!). If the debates were open, the media not Democratic- and Republican-centric, etc., people would actually know something about them, and perhaps just enough to make them think down a different path, thus, opening up possibilities. After all, I thought that's what America is supposed to be about.
Crayon:
Are you an anarchist by chance? What solution do you propose againt these evils?
- bother looking outside of the Democrat/Republican realm
-
Use explode for this level of simplicity.
-
I usually don't vote, because I do not believe in picking the lesser of the two evils.
What about the rest of the "evils"? There were 7 presidential candidates on my ballot.
Okay let me amend that to "Lesser of the $x evils."
So you were well-informed on every single candidate running, enough to deem them all "evil"?
-
IL:
Barack Obama/Joe Biden
Cynthia McKinney/Rosa Clemente
John McCain/Sarah Palin
Bob Barr/Wayne A. Root
John Joseph Polachek/No Candidate
Charles O. Baldwin/Darrell L. Castle
Ralph Nader/Matt Gonzalez
-
I usually don't vote, because I do not believe in picking the lesser of the two evils.
What about the rest of the "evils"? There were 7 presidential candidates on my ballot.
-
$events = array_unique(preg_replace('/( Qualifying)? Round(.)*/', '', $rounds));
I would use /(?:\s+Qualifying)?\s+Round.*/.
-
<pre> <?php $cups = array( 'FA Cup', 'FA Cup Qualifying Round 1', 'FA Cup Qualifying Round 2', 'FA Cup Qualifying Round 3', 'FA Cup Round 1', 'FA Cup Round 2', 'Carling Cup', 'Carling Cup Round 1', 'Carling Cup Round 2', ); $seen = array(); foreach ($cups as $cup) { $cup = preg_replace('/(?<=\bCup)\b.+$/', '', $cup); if (array_key_exists($cup, $seen)) { continue; } $seen[$cup] = null; echo $cup, "\n"; } ?> </pre>
-
Some tips:
[*]Change your delimiters to avoid multiple escapes
[*]When using literal data inside of a pattern, always escape it using preg_quote
[*]Use character classes in place of one character alternations, e.g., (a|b|c)
I suspect the second bullet may alleviate your problem.
-
<pre> <?php $subject = 'The cat sat on the [[straw|mat]]. The cat hoped he would jump through the [[windows]] and catch the [[feathered variety|bird on the branch]].'; preg_match_all( '%\[\[(?:[^]|]+\|)?([^]]+)\]\]%', $subject, $matches ); $matches = $matches[1]; print_r($matches); ?> </pre>
-
%\\\\\\\%
First you have to consider PHP's escaping rules, then the regex rules, which results in a double escaping effect.
-
How about something like this?
<pre> <?php $data = <<<DATA \$my_array = array( 'key' => "value", 'another_key' => 'another_value' ); DATA; preg_match_all('/^\s*(\$\S+\s*=\s*array\(.*?\);)/ms', $data, $matches); array_shift($matches); print_r($matches); foreach ($matches[0] as &$match) { preg_match('/^\s*\$(\S+)/', $match, $name); eval('$array = ' . $match); $result[$name[1]] = $array; } print_r($result); ?> </pre>
-
<?php $data = <<<DATA I dont understand a little about RegEx but cannot really understand how to use all the funtions . I need to convert link tag <a href ....> that DOES NOT already have the css in them. Such as <a href="http://www.google.com" style="font-size: 11px;" other properties> should NOT matched but <a href="http://www.google.com" .. other properties> should match and a style="..." should be added. DATA; echo htmlspecialchars(preg_replace('/<a((??!style=)[^>])+)>/', '<a style="xyz" $1>', $data)); ?>
-
Your meta is commented out, so it may be relying on the browser, server, or file. Is there any meta information in the included files? When you save them, are there any encoding options?
-
What's in your meta tag(s)? Are both files saved as Latin-1?
-
Sanitize the words with preg_quote.
-
It should be fine without the concatenation. Do you have an example of it failing?
-
If you want to match e-mail addresses to a tee, see the RFC.
-
Do they have to be consecutive?
-
There's no point in capturing more than you need:
echo $result = preg_replace('/^.*\.\s+/m', '', $data);
-
Shorthands are not available in EREG; use PREG. Also, why the \s?
<pre> <?php function valid_propadd($pa) { return preg_match('/(?:\w\s?)+/', $pa); } $tests = array( '120_Ho_St', '120_Howe_St', ); foreach ($tests as $test) { echo $test, ' => ', valid_propadd($test) ? 'Valid' : 'Invalid' ; echo '<br>'; } ?> </pre>
-
Try ".+ or ".+$.
-
Is Perl an option? I would array this, if not as an end result, at least in the manner of XML->array->parse->XML.
-
For it to work now the first letter of the actual name must be upper case. Otherwise it doesn't find the name, is there a way that I can make it so that even if the first letter they put in isn't capital, it will still find the name?
ucfirst(strtolower("Name"));
[SOLVED] preg match 2 items in paragraph
in PHP Coding Help
Posted