Two Regex Expressions In One?

Jul 28, 2010

i have the code:

Regex r = new Regex("<tag>([^<]*)</tag>");

but i want to add another set of tags to search between:

Regex r = new Regex("<tag>([^<]*)</tag>|<asd as="b">([^<]*)<asd as=j>");

this does not work.

View 1 Replies


Similar Messages:

Regex - .net URL Rewriting (regular Expressions)?

Aug 20, 2010

As I have the URLs like

http://somedomain.com/products.aspx?id=1

and i want to rewrite this like

somedomain.com/productname and rest of the URLs on the domain work as they are provided.
like

somedomain.com/forums/categories.aspx

I don't want to rewrite these other URLs

View 1 Replies

ADO.NET :: Creating Dynamic Expressions For Lambda IQueryable Expressions?

Sep 30, 2010

I have a ListBox that contains userNames which is inputted by a user during run time. This number of items in the ListBox is dependent on the user's input. These userNames will then be used in a Lambda expression like this:

var vHandleResult = vHandleResult.Where(a => a.UserName.Contains("userName"));

This works fine when there is only 1 user in the ListBox but doesn't produce the correct results when there are multiple items in the listBox. I tried manually creating the expression which should be written as this:

var vHandleResult = vHandleResult.Where(a => a.UserName.Contains("userName1") || a.UserName.Contains("userName2") || a.UserName.Contains("userName3") || a.UserName.Contains("userName4"));

I tried forming the "a.UserName.Contains("userName") expression as a string which is dependent on the number of the items (using foreach) and then just plug in the resulting string in the expression but it seems that it doesnt accept string as an expression.

View 2 Replies

Using RegEx With LINQ - Insert A Value Into The Regex?

Feb 19, 2010

I'm having a little trouble with using regex in linq. I want to be able to perform a search on values in my database. The goal is to insert a value into the regex and then use that to search a column in a table in my database for that term. I want it to work so that it gets all exact matches and also returns matches in which the search term is a substring of the term in the column.

I was trying to follow this tutorial on msdn, but it doesn't quite fit perfectly with my problem:

[URL]

Code:

[code]....

View 11 Replies

Calculate Expressions In .net?

Dec 9, 2010

I am tring to calculate the expressions then my problem is when give in double values it did not working and error with undefined symbol(.). I am using one class file for evaluting the expression.

ex: 10/2+58*7-69 //valid
5655/854*564-552+64/42+215 //valid
but
52.36+56.2 // Not valid

Above are the examples for evaluting method, how can evalute double values give me sample code

View 4 Replies

Display Consecutive Regular Expressions?

Apr 1, 2010

if there are two consecutive apostrophe or two consecutive hyphens or two consecutive comma or two consecutive spaces or two consecutive periods or two consecutive periods..I want to display those particular error.

and One more thing is if there are any of the above combinations like apostrophe+hyphen or apostrophe+space or hyphen+space, I want to throw that specific error.

View 3 Replies

Find Substring With Regular Expressions?

Mar 27, 2011

i take the text of the html of a site and want to select a substring of the whole text. the text is something like this

[Code]....

View 6 Replies

How To Remove Data Outside Div Regular Expressions

May 10, 2010

I think it can be solved by Regular expressions but maby I'm wrong.
I upload a .html file which is saved from a webbrowser. I read the stream and with Stringbuilder I make a string of it.But now I want to have only the data which is in this div:

[Code]....

View 6 Replies

Web Forms :: How To Place Two Regular Expressions

Jan 27, 2010

I have two the below regular expressions for a textbox , to validate.

^(([01]?dd?|2[0-4]d|25[0-5]).){3}([01]?dd?|25[0-5]|2[0-4]d)$ - Validation Expression For IP Address
^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$ - Validation Expression for Host name

I want to use both these for the same textbox, It should fullfill either of these conditions. What should I do so as to satisfy my condition.

View 3 Replies

Web Forms :: Regular And Required Expressions

Feb 2, 2011

[Code]....

View 1 Replies

Combining Expressions Web And Visual Studio?

Mar 24, 2010

My question:

Is it possible to design a page in Expressions Web and then use it in Visual Studio Presently, I am using an asp.net master page in Visual Studio with functionality from the VS tool box (navigation tree, login etc). These work fine but they are not very pretty. How can I keep all the functionality that Visual studio offers (I will be adding an SQL database) but have it looking better than the drag and drop tools in VS. Is it possible or not to connect an Expressions Web Master page easily, so it will drive the site already built in VS - but have a more attractive GUI?

Or, is there something that I am missing in Visual Studio - can I edit the drag and drop tools in there to build a GUI with a Microsoft feel and look?

View 6 Replies

Creating A Sort Expressions For Datatable In Vb.net?

Feb 2, 2010

I have got a datatable which contains many columns in which three are main:

hotelid
dshotelid
hotelname

Some hotels contain only dshotelid, some contains only hotelid and some contain both dshotelid and hotelid.

I need sort in such way so that those hotels who got both dshotelid and hotelid should be on top and then those hotels who have got only dshotelid and at last those hotels who have got only hotelid...

I created this :

dtmaintable.DefaultView.Sort = "dshotelid, hotelid"

but it Is not giving me desired output.

View 2 Replies

Web Forms :: Binding Expressions In Server Controls?

Sep 3, 2010

i'm trying to do the following:

[Code]....

View 16 Replies

Ignore Meta Characters In Regular Expressions?

Apr 17, 2010

I am trying to search titles in this pattern a text. the titles are unknown and sometimes it contains special characters '(' and ')'.... when this is happens the only way to make the match correct is by replace ')' by ')' . is there a way ignoring this replacment? and if not, what are the complete meta(special) characters?

View 1 Replies

Using Resource Expressions With The Resources In A Separate Project?

Oct 26, 2010

I'm pretty sure this is something super easy, but how do i access a resource that is in a separate project using the expression syntax?
I thought it would be like so:

<%$ Resources:SomeNamespace.Resources.Web, PleaseSelectAnImage %>

where SomeNamespace.Resources is the project that the resources are located in.

i normally just do <%= SomeNamespace.Resources.Web.PleaseSelectAnImage%> but i need to have this inside a control.

<kw:SlickUpload ID="SlickUpload1" runat="server"
ValidExtensions=".png, .gif, .jpg"
InvalidExtensionMessage="<%$ Resources:SomeNamespace.Resources.Resources.Web, PleaseSelectAnImage %>" >

so when i just do what i normally do, it puts '<%= SomeNamespace.Resources.Web.PleaseSelectAnImage%>" literally.

my project name is SomeNamespace.Resources. the resource file name is Web. and the key is PleaseSelectAnImage.

View 1 Replies

MVC :: Regular Expressions For Limited HTML Tags?

Jan 7, 2011

I want a limited amount of html tags for the user to be able to put in my form and by looking at the posts, regular expressions seem to be the way forward. I don't want to use javascript or 3rd party as this is for an assignment at university.

The examples I have found seem to be set out differently than mine with using asp id identifiers whereas my code below is set out differently so I am unsure if I can use these examples.

View 7 Replies

Use C# Regular Expressions To Emulate Forum Tags?

Feb 5, 2011

I am building a forum and I want to be able to use simple square bracket tags to allow users to format text. I am currently accomplishing this by parsing the string and looking for the tags. It's very tedious, especially when I run into a tag like this [URL]. Having to parse the attribute, and the value, and make sure it has proper opening and closing tags is kind of a pain and seems silly. I know how powerful regular expressions are but I'm not good at them and they frustrate me to no end. I think an example would get me started. Just a regex for finding tags like [b]bolded text[/b] and tags with attributes like the link

View 2 Replies

Regular Expressions In C# To Detect More Than One Space Between Words?

Dec 24, 2010

I need to use regular expressions in C# to validate a TextBox.

Regular expressions should NOT allowed

more that ONE space between words, considering also beginning and end of the string

UPDATE

I NEED to add this role in ValidationExpress for a Validation Control in ASP.NET

View 8 Replies

Web Forms :: Comparing Two Regular Expressions Of Date?

May 15, 2012

I applied regular expression validator on date of birth and Missing date for a missing person.  the missing date should be greater than the date of birth . I applied compare vallidator but it is not working properly. it comparing day of date of birth with day of missing date, both months and years...

if i give...

date of birth:  2/2/1980

Missing date: 1/2/1981

it is giving the error message...

I applied this regular expression:

^((0?[13578]|10|12)(-|/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|/)((19)([2-9])(d{1})|(20)([01])(d{1})|([8901])(d{1}))|(0?[2469]|11)(-|/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|/)((19)([2-9])(d{1})|(20)([01])(d{1})|([8901])(d{1})))$

View 1 Replies

Why Has Moving GridView Code To An Ascx Given An Databinding Expressions

Aug 20, 2010

I created a GridView in code with a DataTable as its data source which worked fine. I have now moved the GridView creation into a .ascx file to make it easier to format.

For some reason this has started triggering the HttpParseException:
Databinding expressions are only
supported on objects that have a
DataBinding event.
System.Web.UI.WebControls.HyperLinkField
Original code:
// Set up columns for datagrid
var boundField = new HyperLinkField
[code]...

View 1 Replies

ADO.NET :: Error - The Type Of One Of The Expressions In The Join Clause Is Incorrect

Nov 10, 2010

here is my code:

return from c in db.TBLcharacters
join o in db.TBLjobs on c.char_job equals o.job_title
orderby c.char_lastname descending
select c;

The goal is to print out the job title from the seperate table when I list the names of the Employees. So in the final formatting on the view it would be John Doe [Janitor] (or something similiar)

But when I make the build I get the following error:

The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.

What I find wierd is cjar_job and job_title are both varchars so the type is the same.

View 2 Replies

Web Forms :: Regular Expressions For MSSQL Data Types?

Mar 26, 2010

I am getting ready to just write my own, but I have a need for some regular expressions that will validate strings to make sure they are in an acceptable format to be inserted/updated into a database field. I figure it may just be to find a list of them someone has already posted somewhere and just use those.

View 3 Replies

MVC :: Academic: In-line Template For List Of LINQ Expressions?

Jun 5, 2010

If you still clicked this after seeing the title, you are probably like me and sometimes code just for fun. So, that's the spirit of this; all new approaches that solve this will be marked as answer.I have a template that I can't imagine ever using again, but use 5 times on a page. I wanted to DRY up my page a little:

[Code]....

While doing this, I realized that Lambdas confuse me - I had the feeling there was a much simpler way to code it.

View 3 Replies

How To Bind The Button With The Validators So It Will Not Trigger The Code If The Expressions Are Wrong

Sep 29, 2010

Anyway i'm using RegularExpressionValidator and CompareValidator to check on textbox errors.

Now when i press a button it will go to my code and i will then try to detect for RegularExpressionValidator or CompareValidator errors by doing:

If not RegularExpressionValidator.IsValid

Now the question is if there is a way to bind the button with the validators so it will not trigger the code if the expressions are wrong.

I would have goggled it but i don't know exactly what to write on the search box.So i get un-useful results.

View 9 Replies

Where To Find Documentation About Expressions And Syntax Of WebForms View Engine

Aug 30, 2010

Where i can find documentation about expressions and syntax of WebForms view engine?And what is the difference between <%: expression %> and <%= expression %>

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved