473,394 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

preg_replace e modifier

69
Hi,

I'm a PHP newbie and I don't understand what it means about the e modifier makes preg_replace() treat the replacement parameter as PHP code after the appropriate references substitution is done.

I have a file with HTML tags such as follows.

Expand|Select|Wrap|Line Numbers
  1. <DIV class="bottomPostionDiv">
  2. <H1>BENEFITS </H1></DIV>
I have a regular expression to identify the uppercase tags, which I want to convert to lowercase.

Expand|Select|Wrap|Line Numbers
  1. preg_replace( '/<\/*[A-Z]+/', , $matches, PREG_OFFSET_CAPTURE );
.

It's incomplete because I don't know what to put as the replacement text. The replacement text wants to be the matched text converted to uppercase.

How do I do this?

Thanks,

Sean
Sep 25 '07 #1
0 1304

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Richard B. Christ | last post by:
I wrote the following code and it does NOT seem to work. $search = array('/<popup*>/ie'); $replace = array('make_popup(split_tag(\\0))'); preg_replace($search, $replace, $someText); If I try...
8
by: Jochen Daum | last post by:
Hi, I'd like to use something like preg_replace("...","$this->somefunction('\\1','\\2');", $content); It says "Cannot find function somefunction()" I tried some escaping, but didn't...
1
by: yawnmoth | last post by:
say i have the following script: <? $test = "aaaaa"; print '"' . preg_replace('/.*/','x',$test) . '"<br>'; $test = "\n\n\n\n\n"; print '"' . preg_replace('/.*/','x',$test) . '"'; ?> the...
2
by: brendan | last post by:
trying to clear out all text between the outermost <---Message Start---> and <---Message End---> tags using snippet
2
by: yawnmoth | last post by:
Can anyone help me understand the following scripts output?: <? echo preg_replace('/.*/e',"sprintf('\\\\\')",''); ?> The output is \ and this doesn't make a lot of sense to me. Since \\'s...
1
by: correo | last post by:
Hi all! This: $string = preg_replace('//i', '_', $string); replaces an accented letter with two underscores instead of one, when the submitting page is in UTF8 ($string comes from a GET...
1
by: rybasso | last post by:
Hello, Does anyone has an idea why preg_replace() cause 'This page contains no data' in FF and 'This page could not be found' in IE. I spend a lot of time searching any ideas on newsgroups but...
7
by: monomaniac21 | last post by:
hi all using preg_replace how can i replace the letter i in a string with nothing (delete it) when it is the last letter or it is followed by an i? i have products that are listed in a db...
3
by: amygdala | last post by:
Hi there, I'm trying to replace single quoted attributes in HTML tags with double quotes. What I've come up with is this: function replaceSingleQuotesInsideTags( $input ) { $output =...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.