[support] preg_match failes where egrep and PERL succeed?
Luke
drupal at lists.tacticus.com
Wed Feb 3 16:27:42 UTC 2010
Hello
I do not wish to say how long I have been trying to figure this out.
I have a node with a CCK textarea, containing data like this:
123|aabbcc
456|10fe1c
...
In other words, a three digit reference to a hex code.
I am attempting to use a computed field to search that node for the
reference (three digit code), and return only the hex value.
I am using a regular expression to do this. I have tried several varients
of the regexp, all of which work whether I use them in PERL or egrep.
However, when I use drush to test them with preg_match, the test fails
every time.
What might I be doing wrong here? This was supposed to be done hours
ago, of course.
drush 2> /dev/null eval '$datanode = node_load(2736);
$res = preg_match('\''/^200\|([0-9a-fA-F]+)/'\'',
$datanode->field_int_data[0][value], $match); echo $res . ": " . $match[1]
. "\n";'
The output is:
0:
However:
drush 2> /dev/null eval '$datanode = node_load(2736);
echo $datanode->field_int_data[0][value];' | perl -e 'while (<>) { print
$_ if (/^200\|([0-9a-zA-Z]+)/); }'
I get:
200|EEC57C
I gather that the PCRE library has changed some things, but I did not
think the handling of subpatterns was one of them, so I am quite
perplexed. It's probably something quite simple.
N.B.
The reason I am redirecting STDERR to null, is because I get this warning
when running drush.
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20060613+lfs/imagick.so' - libWand.so.9: cannot open shared
object file: No such file or directory in Unknown on line 0
Which is referenced at
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg741806.html,
with no apparent resolution.
Regards,
Luke
More information about the support
mailing list