Hi,

I want this code out of any document:

<h2 id="header-1" style="color: green; text-align: center;">5211</h2>
<h2 id="header-23" style="color: green; text-align: left;">5211</h2>
<h2 variable part of text>5211</h2>

when i use this code:

<h2 .*>[0-9]{4}</h2>

i get this warning:

warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'h' in /var/www/vhosts/psy.cc/www/modules/scanner/scanner.module on line 845.

what search string should i use then?

(if i execute it, all docuemnts trun up empty)

thanks

Comments

drgonzo121’s picture

# 7000 de sociale evolutiefasen
[One or more matches in book bodyfield:]
Can't display search result due to conflict between search term and internal preg_match_all function.

you see, http://psy.cc/2010 everywhere the "2010" needs to be filtered out ...

and the h1 tags also:

<h1 style="text-align: center; color: green;">WAARDE VAN INZICHTEN</h1>

drgonzo121’s picture

searching for:
<h2 style="text-align: center; color: green;" id="header-1">5200</h2>

* Scanning for: [<.*[0-9]{4}

] ...
* Found matches in 232 fields. See below for details.

# warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'h' in /var/www/vhosts/psy.cc/www/modules/scanner/scanner.module on line 845.
# warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'h' in /var/www/vhosts/psy.cc/www/modules/scanner/scanner.module on line 845.
# warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'h' in /var/www/vhosts/psy.cc/www/modules/scanner/scanner.module on line 845.
# warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'h' in /var/www/vhosts/psy.cc/www/modules/scanner/scanner.module on line 845.

Search Results

Found matches in 232 fields:

1. 1010 fenomenologie
[One or more matches in book bodyfield:]
Can't display search result due to conflict between search term and internal preg_match_all function.
2. 1012 systemen
[One or more matches in book bodyfield:]
Can't display search result due to conflict between search term and internal preg_match_all function.
3. 1013 interacties of invloeden

and when i choose replace with "empty string", the whole content of every affected node is gone, empty ...

drgonzo121’s picture

this <h2.*>[0-9]{4}</h2> should also work, according to the Regex Coach app

drgonzo121’s picture

no reg-ex specialists?

thanks anyway :-)

drgonzo121’s picture

i have a deadline :'(

wkmit’s picture

I assume your code looks something like this

preg_match_all('/<h2.*>[0-9]{4}</h2>/', $subject, $matches)

try

preg_match_all('#<h2.*>[0-9]{4}</h2>#', $subject, $matches)

Also, if your trying to search and replace, i assume you will be using preg_replace.

drgonzo121’s picture

hello,

i'm using the "Search and Replace Scanner"-module

http://drupal.org/project/scanner

when i enter your code, it says it doesn't find anywthinh

thanks

drgonzo121’s picture

i'm changing the module php code, it seems to work more or less now, thanks !