I am new to Regex. My input is:
2233 0 0 20180405 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
This line is allowed to be constructed only with: tab, number, float, endofline/newline.
I read line content in C#:
using (var sourceStream = new StreamReader(sourceFilePath))
{
string iteratedLine;
while ((iteratedLine = sourceStream.ReadLine()) != null)
//iteratedLine = 2233\t0 0\t\t20180405\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0
Then i send iteratedLine to validate function.
I only allow the following expressions to be in the string:
1. tab
2. new line/end of line
3. number
4. float (0.123)
The following validation function does not work, What am I missing ?
bool isValid = Regex.IsMatch(inputLine, @"(\d+\.{1}\d*)|(\d)|(\\t)|(\\n)|(\\r)");
If i take the regex (\d+.{1}\d*)|(\d)|(\t)|(\n)|(\r) and use in regex101.com its suppose to fail line that has other character then these 4 restrictions.
Thanks 1