there is a bug...because I was drunk...and forgot ; string lineOfText = "-,2 20 30 5 -5 -5, -55, -55.6" should be string lineOfText = "-,2 20 30 5 -5 -5, -55, -55.6";
// :) On Jun 17, 10:03 pm, Stefan Brandt <[email protected]> wrote: > it is not needed to be so complicated...or if you are only learning > regular expressions...if so...I understand and I will help you further > when I got time...sorry my time is depending on money :) and tomorrow > I got my one week holiday...damn I am at my cottage without > Internet :) ...what disaster can one coder do on holiday...many > things ;) > > E.g. if I have this string > -,2 20 30 5 -5 -5, -55, -55.6 > > Why do you not use a string split function? > string lineOfText = "-,2 20 30 5 -5 -5, -55, -55.6" > string[] wordArray = lineOfText.Split(' '); > > foreach (string s in wordArray) > { > // COMPARE HERE IF THE VALUE IS DECIMAL > MessageBox.Show( s ); > > } > > On Jun 17, 3:15 pm, The87Boy <[email protected]> wrote: > > > I am trying to find all doubles (both positive and negative and > > without a specific length) in a string with Regex.Matches > > > On 17 Jun., 09:19, Stefan Brandt <[email protected]> wrote: > > > > What are you trying to achieve? > > > > Only positive numbers? > > > > if so... > > > > Try with this > > > > (^\d*\.?\d*[1-9]+\d*$)|(^[1-9]+\d*\.\d*$) > > > > Positive decimals, for example 231.33 > > > 0.1 is accepted but 0 or 0.0 is not accepted > > > > or > > > > with integers: > > > > ^\d{1,5}$ > > > > Positive integer from 0 to 99999 (zero is also accepted). 5 describes > > > the length....if it would be 6 -> 0 to 999999 > > > > On Jun 16, 12:34 pm, The87Boy <[email protected]> wrote: > > > > > I am using C# Regular Expression to parse some numbers, but I can't > > > > find the problem in my Regular Expression as it accepts "-2," but it > > > > should not > > > > My Regular Expression is @"([+|-]?)(\d*)([\.|,]?)(\d+)" > > > > Can everybody tell me how to correct this problem?
