Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 3rd, 2003, 02:14 PM
Registered User
 
Join Date: Nov 2003
Location: Canton, OH, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hadware Send a message via Yahoo to Hadware
Default Regular Expression Help

I have a regular axpression that looks like its suppose to work.
"[^X-]+(Priority:)[\s|=20]+(.+)[\s|=20]"

Suppose to match the word Priority: and give the items after that word

there is a part in the document where it says X-Priority: and that is the information it is pulling out for me.

How do I skip the X-Priority: and go to where it says Priority: ?

Also,
I am trying to read the multiple lines.
Item: some text here and an equals sign =
some more here
and finally some more here

I need all that to go into one line and drop the equals sign, like --
some text here and an equals sign some more here and finally some more here

here is the expression i am using for that:
"(Item:)[\s|=20]+(.+)[\s|=20|=]"

Will someone please help me with this?

Thanks
Eric
Reply With Quote
  #2 (permalink)  
Old November 3rd, 2003, 04:08 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Eric,

It does look ok. Try out this simple regex tester: http://www.geekdork.com/tools/DotNetRegExTest.aspx
Maybe there is just a little glitch in your expression that I'm not seeing.

Peter
----------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old November 3rd, 2003, 10:36 PM
Registered User
 
Join Date: Nov 2003
Location: Canton, OH, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hadware Send a message via Yahoo to Hadware
Default

I tried this expression (Item:)[\s|=20]+(.+)[\s|=20|=] on that page with
Item: some text here and an equals sign =
some more here
and finally some more here

and got this result:
Results: Regular Expression returned the following matches:
Item: some text here and an equals sign =

any ideas??
Reply With Quote
  #4 (permalink)  
Old November 4th, 2003, 09:51 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I'm a little confused...

What is meant by the "=20"? Is that something that's happening with your posts or does your regex actually include "=20"?

Perhaps the problem you are having is with the grouping characters. Tell you what... Post an example of the source text you are searching in, and highlight what you want to retrieve in red. Maybe that will make it easier for use to see what you are trying to achieve.

But I'm pretty sure you need to apply an Atomic Zero-Width Assertion to specify that "Priority" should appear at the beginning of the line. Try this regex (remember that you'll need to create your regex with the MultiLine option):

^Priority:.*


For the part where you need to remove the = and carriage returns, can't you just use a simple search and replace? First search for "=" & Environment.Newline and replace that with String.Empty, then search for just Environment.Newline and replace that with String.Empty. That should work for you.

Peter
----------------------------------------
Work smarter, not harder.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Help Please rstelma ASP.NET 1.0 and 1.1 Professional 0 January 2nd, 2008 06:01 PM
REGULAR EXPRESSION pallone Javascript How-To 0 September 5th, 2006 06:52 AM
regular expression if-then smay Javascript 4 July 5th, 2005 12:10 PM
Regular Expression Help Greg Griffiths Javascript How-To 4 November 12th, 2004 04:33 AM
Regular Expression DARSIN General .NET 2 November 9th, 2004 07:30 AM



All times are GMT -4. The time now is 07:22 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.