473,503 Members | 13,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegExp

Hello!

A have a tag <data></data>, but the contente is in multilines. As this:

<data>
Bla Bla Bla Bla Bla
</data>

If I use $regexp = "/<data>([^>]*)<\/data>/" the RegExp does not work.

Do u know what can i do?

Thanks!!!!!!
Jul 17 '05 #1
3 1580
On 19 Mar 2004 11:33:31 -0800, te****@bol.com.br (Otavio) wrote:
A have a tag <data></data>, but the contente is in multilines. As this:

<data>
Bla Bla Bla Bla Bla
</data>

If I use $regexp = "/<data>([^>]*)<\/data>/" the RegExp does not work.

Do u know what can i do?


http://uk.php.net/manual/en/pcre.pattern.modifiers.php

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #2
Otavio wrote:
<data>
Bla Bla Bla Bla Bla
</data>

If I use $regexp = "/<data>([^>]*)<\/data>/" the RegExp does not work.
What did you try exactly, and why? What happens? and what were you
expecting? Are ">"s not allowed between tags? If so, I wonder why
they aren't allowed -- have you created, or are you creating your own
markup notation? Cool. Here's some food for thought

http://www.cs.tut.fi/~jkorpela/data/utd.html

Anyhow, the character class [^>] matches newlines, irrespective of
pattern modifiers. This, to borrow your example, returns true

preg_match(
'`<data>([^>]*)</data>`',
'<data>
Bla Bla Bla Bla Bla
</data>')
Do u know what can i do?


No, since I don't know what you're trying to do. Incomplete assumed
solutions aren't problem descriptions.

--
Jock
Jul 17 '05 #3
On 19 mars 2004, Sir te****@bol.com.br (Otavio) claimed in
news:3b**************************@posting.google.c om:
Hello!

A have a tag <data></data>, but the contente is in multilines. As this:

<data>
Bla Bla Bla Bla Bla
</data>

If I use $regexp = "/<data>([^>]*)<\/data>/" the RegExp does not work.

Do u know what can i do?

Thanks!!!!!!


try:

$regexp = "/<data>(.*)<\/data>/Um";

U option is for Ungreedy else it'll take everything till the LAST </data>
tag

and m is for multilines.

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
39326
by: Anand Pillai | last post by:
To search a word in a group of words, say a paragraph or a web page, would a string search or a regexp search be faster? The string search would of course be, if str.find(substr) != -1:...
5
2336
by: Lukas Holcik | last post by:
Hi everyone! How can I simply search text for regexps (lets say <a href="(.*?)">(.*?)</a>) and save all URLs(1) and link contents(2) in a dictionary { name : URL}? In a single pass if it could....
0
1799
by: Chris Croughton | last post by:
I'm trying to use the EXSLT regexp package from http://www.exslt.org/regexp/functions/match/index.html (specifically the match function) with the libxml xltproc (which supports EXSLT), but...
4
7448
by: Jon Maz | last post by:
Hi All, I want to strip the accents off characters in a string so that, for example, the (Spanish) word "práctico" comes out as "practico" - but ignoring case, so that "PRÁCTICO" comes out as...
8
2003
by: Dmitry Korolyov | last post by:
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web server. A single-line asp:textbox control and regexp validator attached to it. ^\d+$ expression does match an empty...
26
2081
by: Matt Kruse | last post by:
Are there any current browsers that have Javascript support, but not RegExp support? For example, cell phone browsers, blackberrys, or other "minimal" browsers? I know that someone using Netscape...
7
3422
by: Csaba Gabor | last post by:
I need to come up with a function function regExpPos (text, re, parenNum) { ... } that will return the position within text of RegExp.$parenNum if there is a match, and -1 otherwise. For...
4
2739
by: conan | last post by:
This regexp '<widget class=".*" id=".*">' works well with 'grep' for matching lines of the kind <widget class="GtkWindow" id="window1"> on a XML .glade file However that's not true for the...
6
2255
by: runsun pan | last post by:
Hi I am wondering why I couldn't get what I want in the following 3 cases of re: (A) var p=/(+-?+):(+)/g p.exec("style='font-size:12'") -- // expected
4
3890
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global'...
0
7212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
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
7470
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...
0
5604
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.