.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

How to read string end with question mark in regular expression?

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :.NET Framework
 
Hello, I'm facing problem when I read string which is ended by question mark. I use in my code as the following. \"?(?<myfield>[^\"]?.*[^\"?]?)\"? If string is ended by question mark, it's not working. Please help me to solve my problem. Thanks. Co Coe


View Complete Post


More Related Resource Links

regular expression: Read a multi line paragraph

  
I am trying to build a regular expression that will capture a paragraph of any length that starts with "Ordinance Summary:" and ends with "<=>" but doesn't actually include them in the selection.  And I need it to stop at the first instance of <=>. Here is an example of what what I might encounter: "Ordinance Summary: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci. Aenean nec lorem.<=> Ordinance Sponsor:Rhuarch<=>"   And here is what I would need it to actually capture: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci. Aenean nec lorem.   And here is the expression I tried which didn't work: (?<=Ordinance Titl

Regular Expression for looking for Colons (:) in a string

  
Hi I am really struggling with this! Using the regular expression validator I created an expression, thus "\:" to show an error message if the user tries to enter in a name that contains a colon. What I am getting is the error message showing even when there is no colon (:) in the string. What am I doing wrong? Thanks    

Regular expression - exclude certain string

  
Hi all,I have the following regular expression replacement:<add key="^/([^/]*)\.aspx\?" value="/default.aspx?pagename=$1&"/>What this is used for is URL re-writing, i.e. if a page comes in with the path "/test.aspx", it goes to the actual path which is "/default.aspx?pagename=test"This works fine, but it catches all page names. I would like to exclude a particular page name so it is not rewritten, for example if the page was called "exclude.aspx" it would not rewrite to "/default.aspx?pagename=exclude" but stay as "exclude.aspx".How do I modify ^/([^/]*)\.aspx\?so it excludes a certain page name?Thanks!

how does the string validation work for this regular expression?

  
 string
 _strInt = value.ToString();
Regex objPattern = new Regex("[^ a-zA-Z]" ); if (objPattern.IsMatch(_strInt)) { return   new ValidationResult(true , null );
   } else return new ValidationResult(false , "Value must contain only alphabets" ); } }


if i pass a valid expression as "abc" .. its Failing .
Can some1 explaing how it's failing .

How to use Regular Expression to find a particular pattern and its index in the string??

  

Hi!

I need some help here. I have a document containing some string like the following:

TypeName="$Ref-7a1df965df8b43a19f3bcb0928340392BusinessGoal"

Now what I need is that I need to extract this "BusinessGoal" which as you can see, is 32 characters ahead after "-" (hyphen) and change it's case to uppercase.

The real challange is that, This "BusinessGoal" should only be replaced only and only where there is "Ref-<any 32 characters>" before it and not all. So if I find something like TypeName = "BusinessGoal"  it will be simply ignored.

So how am I going to make that reg Ex. I think it would be a combination of Regex and String Api. 

Kindly help me out.

Thanks and regards

 

 


Fahad Ali Shaikh

replace tab in the string using regular expression

  
hi,
      I want to replace tab space with "|" in the string using regular expressions.
I have tried for

Dim strTabString AS string = "A             B             C "                 
TextBox1.Text = Regex.Replace(strTabString , "\t", "|")
But i m not getting the results.

Thanks.

Regular expression question

  

Hi,

I am using the following regular expression

\b((?<!\-)|(?<!\/))wordC(?!\-)\b

to match "wordC" on a block of text

"start paragraph ... /wordA-wordB-wordC ... end paragraph".

I want a match only on the "wordC" that has no preceeding and|or trailing "-" and "/" or any other symbols that I might need to add later.  The above regular expression is not producing the result I want.

Please help me on this.

Thank you.

JP


Regular expression: String start with
end with
or
which ever comes first

  

Regular expression is hard. Can anyone help me with this one?

I need to get XYZ 123 and abc 134

from this html code below:

<html>

<div>XYZ 123<br />

<div>abc 134</div>

</html>

 Thank you in advance!


regular expression thar allow except ".aspx" this string

  

hi i am new in regular expression

can anybody understood me how can i make a regular expression that

allow all the mismatch case  and don't a match case

ex: ".aspx"

( when i put any thing in text box it allow ----a ,ab ,adn.jpg ) result=true

(but when i put =.aspx ) result= false  


Regular expression for splitting string

  

Hi

i have a string like this 

hello<one>world<two>

i want to split like this

hello

one

world

two

pls help me 

thanks in advance


Regards, Anoop

Regular Expression Match Exact String

  

I'm looking for a regular expression that satisfies one of the two conditions (Reg Expression OR Exact String Match W/ Underscores) listed below.

^([0-9])(:([0-5][0-9]))$

OR

_:__

 

Thanks in advance


connection string question from a newbie

  

when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"


Security Briefs: Regular Expression Denial of Service Attacks and Defenses

  

Microsoft security expert Bryan Sullivan believes denial-of-service blackmail attacks will become more common as privilege escalation attacks become more difficult to execute. He demonstrates how to protect your apps against regular expression DoS threats.

Bryan Sullivan

MSDN Magazine May 2010


Help with regular expression

  

Hello,
I am using this regular expression: /.*-lyrics-.*$

and I need the expression find urls like this:
http://domain.com/lor-mbongo-lyrics-loboko-txphzzf

and it do really does that!

The problem is that it finds also this URL:
http://domain.com/lost-lyrics-5mk4f/lyrics

Whar regular expression should I use to exclude urls that end with /lyrics ?

Thanks :]

 

 


Need regular expresion for this string

  

Hi All,

I would be grateful if some one can provide me regular expression for extracting just  myhomepage from below url:

http://local.mysite.com/meet-manish/myhomepage.aspx

Thanks in advance for replying(as always).

With Warm Regards,

Manish



Regular Expression to Match
in HTML

  

Here is the kind of text I want to match via a regular Expression

The id="dgSchedule" is always present in the TAG but its location may differ

The table is span over multiple line/contains white spaces/tabs...

I have the regular expression to match the start and end tag respectively over a single line

\<table .*\>

\</table\>

The problem is to match the whole table span over multiple lines

<table cellspacing="0" rules="all" border="1" id="dgSchedule" style="border-style:None;height:100%;width:100%;border-collapse:collapse;">
	<tr class="blackbar" align="center" style="background-color:#7FB4DE;font-family:Verdana;font-weight:bold;height:20px;">
		<td>From Place</td><td>To Place</td><td>Time</td><td>Bus Type</td>

	</tr><tr style="background-color:#DEECF5;">
		<td>1</td><td>2</td><td>00:15</td><td>Express</td>
	</tr><tr style="background-color:#EFF5FA;">
		<td>2</td><td>3</td><td>00:15</td><td>Express</td>
	</tr><tr style="background-color:#DEECF5;">

		<td>3</td

Need a regular expression

  

I have a required field validator for a texbox, but I just found out that the texbox can have a space in it (for a delimiter, let's say).

I checked the .net and regexlib.com, but couldn't find what I was looking for.

I simply need a regular expression that basically excepts any character string including spaces in it or even a space by itself

Can someone help me out?


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend