473,396 Members | 2,014 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,396 software developers and data experts.

Help with RegExp!

i need a regexp to parse some like this
<AwordHereany thing here #$% #@$#@ /./09812 anything </AwordHere>

this works for that:
<(?<field>\w+)>(?<value>.*)(?<field></\w+>)

but when i have
<AwordHereany thing here #$% #@$#@ /./09812 anything </AwordHere>
<OtherWordHereany thing here #$% #@$#@ /./09812 anything </OtherWord>
my value string gets

"any thing here #$% #@$#@ /./09812 anything </AwordHere>
<OtherWordHereany thing here #$% #@$#@ /./09812 anything"

can any one help me?... thanks...

Oct 21 '06 #1
2 1059
celerno wrote:
i need a regexp to parse some like this
<AwordHereany thing here #$% #@$#@ /./09812 anything </AwordHere>

this works for that:
<(?<field>\w+)>(?<value>.*)(?<field></\w+>)

but when i have
<AwordHereany thing here #$% #@$#@ /./09812 anything </AwordHere>
<OtherWordHereany thing here #$% #@$#@ /./09812 anything </OtherWord>
my value string gets

"any thing here #$% #@$#@ /./09812 anything </AwordHere>
<OtherWordHereany thing here #$% #@$#@ /./09812 anything"

can any one help me?... thanks...
Make the match non-gready. Put a question mark after ".*".
Oct 22 '06 #2
thanks, it works... magically! xD
Göran Andersson ha escrito:
celerno wrote:
i need a regexp to parse some like this
<AwordHereany thing here #$% #@$#@ /./09812 anything </AwordHere>

this works for that:
<(?<field>\w+)>(?<value>.*)(?<field></\w+>)

but when i have
<AwordHereany thing here #$% #@$#@ /./09812 anything </AwordHere>
<OtherWordHereany thing here #$% #@$#@ /./09812 anything </OtherWord>
my value string gets

"any thing here #$% #@$#@ /./09812 anything </AwordHere>
<OtherWordHereany thing here #$% #@$#@ /./09812 anything"

can any one help me?... thanks...
Make the match non-gready. Put a question mark after ".*".
Oct 23 '06 #3

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

Similar topics

5
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....
4
by: pekka niiranen | last post by:
Hi there, I have perl script that uses dynamically constructed regular in this way: ------perl code starts ---- $result ""; $key = AAA\?01; $key = quotemeta $key; $line = " ...
8
by: timmy_dale12 | last post by:
I need help with this one. I have a function that pastes a row. In each row i am pasting a link which is to call a date picker javascript function. This is the code that pastes the link : link =...
5
by: Iain Downie | last post by:
Dear Group, I have a text field that I wish to cellect numbers of bird seen. However, some folk want to use 'c' before the number or '+' after to indicate a fuzzy number. I have tried creating a...
4
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...
3
by: Roy W. Andersen | last post by:
Hi, I need to do some replace-calls on certain strings in order to replace smiley glyphs and other keywords with graphical icons on the client. Unfortunately, my knowledge of regular expressions...
7
by: VUNETdotUS | last post by:
How can I get the text after matching string is found: var str = "1111>AAAA<2222>BBBB<3333>CCCC"; if(str.indexOf("2222>")){ //how to get "BBBB" value following my "2222>" but before "<3333"...
3
by: Happy Face | last post by:
Hi, All, I encountered this strange problem while using function preg_match. The following is the php code. when I set the line: $text = str_repeat('*', 12500); preg_match will return 0 for...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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
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,...

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.