Break A String Using Regular Expression?

Jan 19, 2011

I am working on a web application in which I am getting a string from database and breaking it to use it. This is the string: string str = "DB1031229";

But sometimes I am not getting proper results. I need to break it in :

DB

10

1229

You can notice that I have not included 3 in that. I dont need that.

View 1 Replies


Similar Messages:

Regular Expression / Input String Is Valid Based On The Given Regular Expression?

Sep 20, 2010

i have to check if an input string is valid based on the given regular expression.. this is the regular expression.

(a(bb+aaa+((ab)*bb+(aba)*aa)(a+b)*) + (b(aa+bbb+((ba)*aa+(bab)*bb)(a+b)*)

+ is an OR

* is a LOOP, it is optional, it may be done as many as a user wants.

i've tried many ways to solve the problem that my professor gave me but my knowledge isn't that enough to solve this problem..

View 3 Replies

Regular Expression For Looking For Colons (:) In A String / Error There Is No Colon In String

Sep 2, 2010

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?

View 4 Replies

Regular Expression - How To Exclude Certain String

Sep 13, 2010

I have the following regular expression replacement:

[Code]....

how to exclude certain string

View 4 Replies

Regular Expression For Validate Alphanumeric String?

May 4, 2010

give me Regular expression for validation string that must have at least one alphabet and at least one numeric value?

View 7 Replies

Web Forms :: How To Create Regular Expression For String

Mar 4, 2010

I'm having a TextBox and it can be accept only the string like "49=N,38=S,56=S,......"

so can u tell me how can i create my regular expression for validate above string.

View 2 Replies

Regular Expression To Get Two Distinct Numbers From A String?

Jun 10, 2010

Suppose i have this input string "3rd position 5th time"

I want to write a Regular Expression to get 3 and 5 in a String like this "3 5" i.e., 3 and 5 both will be in a String but having a space. 3 and 5 may be any numbers like 12 or 13 ony any other numbers. For this i wrote this Regular Expression

Dim regexpression As
String =
"^[0-9]*+[0-9]"

but its not working .I am unable to get the logic.

View 5 Replies

Web Forms :: Regular Expression / Textbox String Should Be In Value?

Apr 26, 2010

I am new to regular expression. Could you give me the syntax in asp.net??

The textbox string should be int value, non zero, non-negative.

View 6 Replies

Capture Instances Of '&#' In A String Using A Regular Expression?

Aug 4, 2010

I am trying to capture instances of '&#' in a string using a regular expression.

The best validation expression I can come up with is [^&#]*

This captures &# but unfortunately also captures & and # on their own.

How do I make the expression only look for &# together?

View 4 Replies

Write A Regular Expression That Will Match If The 6th Character Of A String Is One Of Two Different Letters?

Jul 21, 2010

I'm trying to write a validator for an ASP.NET txtbox.

How can I validate so the regular expression will only match if the 6th character is a "C" or a "P"?

View 5 Replies

Web Forms :: Create A Regular Expression From A String Or An Array Of Domain Names?

Feb 25, 2010

I need a way to create a regular expression from a string or an array of domain names. for example string array = [URL]. Once I click save I would want to create a regular expression that would match all 3 with or without '.com' extension. Then Another task would be to pull this data out of regular expression and put it back into an array.

View 5 Replies

Regular Expression Thar Allow Except ".aspx" This String?

Nov 19, 2010

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

View 5 Replies

Web Forms :: Regular Expression Validator / Add Wording To Current Expression:  W+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*?

Feb 16, 2010

I'm trying to use the validator to work on a email form to ensure that they enter a valid from email address. That part works. I also want to add to the expression the text that I pre-populate in the txtbox ("Enter your email address") so on postback, after sending the message, I can clear the fields and repopulate that box.

How do I add that wording to the current expression: w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*

View 4 Replies

Web Forms :: Validation Expression For Regular Expression Validator?

Feb 2, 2011

I am using Regular Expression validator for a text box. The below is working fine.It is not performing validation when I enter values like 0000..001.How can I modify validation expression? But it would allow values like 100,...5000 i.e zeros after a number.

<asp:RegularExpressionValidator ID="reg2" runat="server" ControlToValidate="rng2"
ValidationExpression="^[0-9]+" ErrorMessage="*Please Enter a Valid Number for Second Range."
ForeColor="Red" Font-Bold="True"></asp:RegularExpressionValidator>

View 2 Replies

Regex - Regular Expression And Validation Expression ?

Dec 1, 2010

I need some help in regular expression.I am validating the textbox text when updating the records.When i click the update button,the first 5 letters should be equal to CM000 or cm000.How to validate this using regular expression in asp.net. does anyone know validationexpression for this.

View 1 Replies

C# - Regular Expression For Dd-MMM-yyyy And Dd-MMM?

Oct 4, 2010

I need a regular expression for support both date formats dd-MMM-yyyy and dd-MMM.

Ex:

04-Oct-2010
04-Oct
04-OCT-2010
04-OCT

View 3 Replies

Why Get A Error When Use Regular Expression

May 11, 2010

Regex rxQuarter = new Regex("d{5}"); why i get a error when i use this regular expression..its not recognising the "d"

View 2 Replies

How To Check The Regular Expression

Nov 17, 2010

how can i check the regular expression for the following? the string should only contain this

0-9
a-z
A-z
! # $ % < > ( ) * + - _ ,.;:/ += [] @

View 10 Replies

Regular Expression Letters Only?

Nov 19, 2010

I would like to know what the expression for "letters only" is for my asp.net web application. I tried ^[A-Za-z] but it does not work I would also like a regular expression for "numbers only except "-"

View 3 Replies

Regular Expression Validation For Url?

Apr 21, 2010

writing the Regular expression validator for Url or web address,

I tried

(http(s)?://)?([w-]+.)+[w-]+(/[w- ;,./?%&=]*)?

But its aspecting http:// every time, i need to something which accept http:// and also without http://

i tried this one which i got from internet, but this accepts wwww, or wwwtest.co

(([w]+:)?//)?(([dw]|%[a-fA-fd]{2,2})+(:([dw]|%[a-fA-fd]{2,2})+)?@)?([dw][-dw]{0,253}[dw].)+[w]{2,4}(:[d]+)?(/([-+_~.dw]|%[a-fA-fd]{2,2})*)*(?(&?([-+_~.dw]|%[a-fA-fd]{2,2})=?)*)?(#([-+_~.dw]|%[a-fA-fd]{2,2})*)?"

View 10 Replies

Regular Expression On The URLRewriter?

Oct 27, 2010

I have the following:

[Code]....

Now the (.+) will not load up the page and throw an error if I have a + in the query string. what can I do?

View 7 Replies

Regular Expression For A Range And -1?

Jan 24, 2011

I am trying to write a Regular Expression Validator to allow users to input any number (either positive or negative), except 0. I tried the followings but obviously they failed:

^[1-9-]{1,10}$ <= failed when the 2nd to n-th digit is 0

^d+$ <= failed to treat negative numbers as valid

View 6 Replies

Modifying A C# Regular Expression?

Feb 24, 2011

I am using a regex to detect forum tags within posts, such as "[quote]text[/quote]" and then replace them with HTML formatting. I posted a question Forum tags. What is the best way to implement them? about a problem with nested tags.

I need this regex modified

string regex = @"[([^=]+)[=x22']*(S*?)['x22]*](.+?)[/(1)]";

Right now this matches an opening and closing tag, with match groups for the tag name, the tag content, and an optional value like the value after the equals in this forum tag [url=www.google.com]click me[/url].

What I need is for the expression to match the opening tag OR the closing tag and have a match group containing the tag name (including the '/' for the closing tag). I then want to iterate through them sort of like this:

Dictionary<string, int> tagCollection = new Dictionary<string, int>();
inputString = Regex.Replace(inputString, @"expression I'm asking for here",
match =>
{

[Code]....

So now, each tag is appended with a number and I could use the original regex to perform the tag functions and properly handle nested tags as separate tags.

View 2 Replies

Mobile Regular Expression?

Sep 17, 2010

I have one field in database Mobile No.

In that I want to put validation which accepts "+" and numbers that is not more then 15.

And in that "+" should at the first place in value.

View 1 Replies

Regular Expression To Get First Image?

Oct 6, 2010

I got this code from a regular expression library to get the src of the image found in a given input. However I can't get it to work because the double quotes(") in the regular expression is closing the string under the second parameter for the .Match function. I tried changing double quotes(") to " but it doesn't work too.

[Code]....

View 3 Replies







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