Click here to Skip to main content
15,505,601 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
AnswerRe: A little help needed... Pin
Richard Deeming20-Mar-14 7:00
mveRichard Deeming20-Mar-14 7:00 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 8:02
professionalMarco Bertschi20-Mar-14 8:02 
AnswerRe: [Solved] Pin
Kenneth Haugland20-Mar-14 21:55
mvaKenneth Haugland20-Mar-14 21:55 
GeneralRe: [Solved] Pin
PIEBALDconsult25-Mar-14 13:30
professionalPIEBALDconsult25-Mar-14 13:30 
QuestionMATLAB Code Pin
Member 1068110218-Mar-14 20:02
Member 1068110218-Mar-14 20:02 
QuestionRe: MATLAB Code Pin
Richard Deeming19-Mar-14 3:04
mveRichard Deeming19-Mar-14 3:04 
AnswerRe: MATLAB Code Pin
Kornfeld Eliyahu Peter19-Mar-14 6:00
professionalKornfeld Eliyahu Peter19-Mar-14 6:00 
QuestionParsing ASCII-Only string Pin
Marco Bertschi6-Feb-14 23:54
professionalMarco Bertschi6-Feb-14 23:54 
Yess, I am still struggling with RegEx.

What I have done so far is to validate a string whether it consists of printable ASCII chars only.

C#
 /// <summary>
/// The name of the host which has originated the Syslog message
/// </summary>
string host;
/// <summary>
/// Gets or sets the name of the host which has originated the Syslog message
/// </summary>
public string Host
{
    get { return host; }
    set
    {
        Regex regex = new Regex(@"(\40-\176)");//Printable ASCII characters only
        Match match = regex.Match(value);
        if (match.Groups.Count == 1)
        {
            host = match.Groups[1].Value;
        }
    }
}

Is there a shorter way of approaching this?
Also, the RegEx currently produces no match if there is an invalid ASCII char in the string, what would I need to do to just remove the faulty part?
Clean-up crew needed, grammar spill... - Nagy Vilmos

AnswerRe: Parsing ASCII-Only string Pin
Richard Deeming7-Feb-14 2:36
mveRichard Deeming7-Feb-14 2:36 
GeneralRe: Parsing ASCII-Only string Pin
Marco Bertschi7-Feb-14 2:50
professionalMarco Bertschi7-Feb-14 2:50 
GeneralRe: Parsing ASCII-Only string Pin
Richard Deeming7-Feb-14 3:04
mveRichard Deeming7-Feb-14 3:04 
QuestionRe: Parsing ASCII-Only string Pin
Marco Bertschi7-Feb-14 3:08
professionalMarco Bertschi7-Feb-14 3:08 
AnswerRe: Parsing ASCII-Only string Pin
Richard Deeming7-Feb-14 3:14
mveRichard Deeming7-Feb-14 3:14 
GeneralRe: Parsing ASCII-Only string Pin
Marco Bertschi7-Feb-14 3:33
professionalMarco Bertschi7-Feb-14 3:33 
QuestionParsing a string with match groups Pin
Dominick Marciano23-Aug-13 10:47
professionalDominick Marciano23-Aug-13 10:47 
AnswerRe: Parsing a string with match groups Pin
Matt T Heffron28-Oct-13 12:33
professionalMatt T Heffron28-Oct-13 12:33 
AnswerRe: Parsing a string with match groups Pin
Gabriel Szabo7-Nov-13 22:27
Gabriel Szabo7-Nov-13 22:27 
QuestionMatching a string. Pin
Septimus Hedgehog19-Aug-13 5:48
Septimus Hedgehog19-Aug-13 5:48 
AnswerRe: Matching a string. Pin
PIEBALDconsult19-Aug-13 6:03
professionalPIEBALDconsult19-Aug-13 6:03 
GeneralRe: Matching a string. Pin
Septimus Hedgehog19-Aug-13 6:27
Septimus Hedgehog19-Aug-13 6:27 
GeneralRe: Matching a string. Pin
PIEBALDconsult19-Aug-13 6:31
professionalPIEBALDconsult19-Aug-13 6:31 
GeneralRe: Matching a string. Pin
Septimus Hedgehog19-Aug-13 6:44
Septimus Hedgehog19-Aug-13 6:44 
GeneralRe: Matching a string. Pin
PIEBALDconsult19-Aug-13 10:01
professionalPIEBALDconsult19-Aug-13 10:01 
GeneralRe: Matching a string. Pin
Septimus Hedgehog20-Aug-13 0:04
Septimus Hedgehog20-Aug-13 0:04 
QuestionHelp wanted with regex format. Pin
Septimus Hedgehog31-Jul-13 4:17
Septimus Hedgehog31-Jul-13 4:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.