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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Help me modify regex code, only one line.

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :.NET Framework
I have this code Dim parts As New List(Of String)(Regex.Split(RichTextBox2.Text, "~\d")) That splits lines in this format into parts: ~1Hello~2~3Bye~4~5Morning~6 So if I do MsgBox(parts(5)), it will show me "Morning". ------------------------------------------------------------------------ I want to do the exact same thing, but now my my line is arranged like this: Hello, Bye, Morning,   

View Complete Post

More Related Resource Links

Whats wrong with this code, im getting blue line under the createStatus next the switch

Error message: Use of unassigned local variable 'createStatus'
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

multi-line regex in C#

Hi, I am sure this is really simple, but i can't figure it out. I have a string that looks like this: REV=A1 STATUS=Working I would like to grab 'A1' and 'Working', in a single regex, but i cannot seem to handle the linebreak. I have tried putting something together in Rad's Regular expressions designer and this pattern will match it all: REV=(?<Rev>.{2}) STATUS=(?<Status>.+) but i don't know to write a two-lined regex in C#. I have also tried to include the linebreak, with both \n and \r, but none of them worked. So, how is my pattern suppoed to look for this?Nicolai Søndergaard LM Glasfiber A/S

REGEX does not match when line ends with the characters.. also, how to negate words that contain the

\S*(ai|ie)\S*   seems to match all words with characters ai and ie in them.  However it does not match if the line ends with them, how can fix that?Also, how can I match all words that DO NOT contain those characters.. I've tried ?! and [^ to no avail.Thanks in advance for any help or information!

.net 3.5 in conjunction with CRM 4.0 email router adding code to subject line of emails causing spam

We use CRM 4.0, which is using .net framework 3.5 SP 1.  Emails sent out of CRM go through and email router and the subject line of these emails is getting "=?us-ascii?Q? added to the beginning of the subject line and "?= added to the end of the subject line. This is causing a large amount of our emails getting spammed. I was told by the CRM support that this is an issue with .net 3.5 and won't be fixed until .net 4.0, which CRM won't support for another year.  Is there not a .net 3.5 patch that can address this?

Modify Subject line of Notification e-mails sent by Database Mail

Hello All, I am using database mail for SQL Server Agent Job notification.  It is working just great. However the e-mails that I receive have a specific format of subject line as below. SQL Server Job System: 'TEST' completed on \\Server_Name I wanted to see if I can modify this to send e-mails with this subject line. SQL Server Job System: 'TEST' completed on <Server_Name> Is this possible?  If so can someone help me with the steps? Thanks.

Can someone please explain what this line of code is actually doing

I took this line of control from this post http://forums.asp.net/t/1201593.aspx I'm actually trying to do the same dynamic accordion.   MyAccordion.ItemDataBound += new EventHandler<AccordionItemEventArgs>(MyAccordion_ItemDataBound);    I converted to vb.net and this is the equivalent. MyAccordion.ItemDataBound += New EventHandler(Of AccordionItemEventArgs)(MyAccordion_ItemDataBound) when I type  that line in my code I get an error.. Error 3 'Public Event ItemDataBound(sender As Object, e As AjaxControlToolkit.AccordionItemEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.    and   Error 4 Delegate 'System.EventHandler(Of AjaxControlToolkit.AccordionItemEventArgs)' requires an 'AddressOf' expression or lambda  

How do I obfuscate .Net IL code using command line program?

How do I obfuscate .Net IL code using command line program? I want free tool that can be deployed to obfuscate DLL generated from compiled tool?

set the proerty from code behind line chart wpf

< Style x:Key = " InvisibleDataPointStyle " TargetType = " c:LineDataPoint " > < Setter Property = " Opacity " Value = " 0 " /> < Setter Property = " Background " Value = " Yellow " /> </ Style >

Need vb.net equivalent of this line of c# code....

I have a line of c# that I'm looking to convert into vb.  It looks like the following:return GetFromSession("CurrentUser") as Account; "GetFromSession" is a method which returns an object. Here's the code for that method if it helps:private static object GetFromSession(string key) { if (HttpContext.Current == null || HttpContext.Current.Session == null) { return null; } return HttpContext.Current.Session[key]; } My problem is the "as Account" part of my one line of c# code needs to be converted into vb but I'm not sure of the equivalent. Currently, my vb.net won't allow it. Any idea what I should use here? Thanks  

SharePoint - Defaulting a Value into the obscure SharePoint:FormField controlMode=New code line

I think I've done it before somehow. but can't remember. Is there any way to force a default value into this  Markup? I've tried a few things with no luck.  Iknow i can doing in javascript codek but wanted to double check I might just not be able to force it here. The code below is binding my a column textbox to a list column while in insert mode.  Generated when I ask the DataView Designer to create a NEW button.  I just want to force the value of a querystring parameter into the column and really not even see the column. Thanks     <SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff3',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}" />

Help with line of code

 Hello - Can someone explain what is happening with this piece of code. I am not sure about the "==" if (Session["_serial"] + "" == "") Response.Redirect("menu.aspx", true); Thanks,   RD

Where can i place this line of code so that its accessible thruout my entire web application?


Currently im capturing the users name during certain functions, so at the moment, i have the line below within each event that i need that information. Instead of having that line everywhere, cant iplace that line in a class or something so that i can just access it by "usn" string usn = User.Identity.Name.ToString();

how write code in my javascript function and modify it?


hi there
i have a function in my javascript code:

   <script language="Javascript">
  function showAddress(address)

          if (geocoder) 

actually, i set GeoMap variable from asp.net
the problem is that when GeoMap change value, the script does not change!
so, the button who change this value is in a UpdatePanel, does this got problem?

how can i do this?

modify sql data source command in code behind


i had a requirement for dynamic sorting so i wanted to assign order by.. dynamically depending on what column is clicked for sorting

i tried to modify the sql data source command 

in ds selecting event

by using


but it doesnt work as it always picks up selectCommand specified in aspx page

Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'MODIFY'





Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'MODIFY'.


how to use regex to identify the number of links in html source code


Hi, all, how to count the number of links in a piece of html source code, is it possible to use regex, for example, create a regex "href" and to count for matches? thanks in advance.

for example, a segment of html code like this:

<TD style="PADDING-RIGHT: 3px" width=150><A id=a588660 onclick="return Evar16_tracking('588660');" href="/products/shprodde.asp?sku=588940"><IMG style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc

Looking for a RegEx expression to eliminate extra whitespace in a line

I have a db column that allows users to input freeform text for, say, a firm name. I would like to remove extra whitespace between names, such that "The   Irvine Company" would become "The Irvine Company". What is the best way to do this?
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