Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 3rd, 2003, 03: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
  #2 (permalink)  
Old November 3rd, 2003, 05: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,407
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.
  #3 (permalink)  
Old November 3rd, 2003, 11: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??
  #4 (permalink)  
Old November 4th, 2003, 10: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,407
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.


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 07: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 05:33 AM
Regular Expression DARSIN General .NET 2 November 9th, 2004 08:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.