Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need a regular expression to extract number 513922 from this string.
Error detected (513922: settings can not be applied.), param d1=0.0, d2=0.0 in operation mode
If you insist on regular expression:
string source =
"Error detected (513922: settings can not be applied.), param d1=0.0, d2=0.0 in...";
// 513922
string result = Regex.Match(source, #"(?<=\()[0-9]+(?=:)").Value;
// if you want integer representation:
int number = int.Parse(result);
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to create a GUI in C#. In this GUI, I have a single text field and when I fill this text field, I would like to see how many Upped-case, Lower-case and special characters are used.
About upper and lower take a look this.
int upperCasecount = s.Count(c => char.IsUpper(c));
int lowerCaseCount = s.Count(c => char.IsLower(c));
This is for the case of special characters count.
int numOfSpecialChar = s.Count(c => !char.IsLetterOrDigit(c));
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a string like:
43965.96000,16933.986,404689.986,5814892.171,77.464,52.47585589,13.59670032,77.464,0.675,-0.223
I want to just keep the string which is bold in characters between commas. How can I do that?
To take your question literally, you could do write a method to split the string by comma and just take the element at the 5th index:
string ParseData(string data)
{
return data.Split(',')[5];
}
So you'll be able to do something like:
string data = "43965.96000,16933.986,404689.986,5814892.171,77.464,52.47585589,13.59670032,77.464,0.675,-0.223";
string result = ParseData(data); // Result = "52.47585589"
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm new to regex but it looks as though this will work for what I need, but I just can't get my head around it.
I have a string "MAMMOTH 9MM" as an example.
All should stay upper case except the specified chars of "MM" after any digit.
Should be simple?
You can look for regular expression patterns and apply a lambda function to modify the matches:
input = Regex.Replace(input, #"(?<=\b[0-9]+)MM\b", m => m.ToLower())
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to perform a search to C# list object to find all products starts with any number or special characters only. I am looking for a Regular expressions for this scenario.
Please help
Assuming you list is a list of string:
var newList = yourList.Where(element => Regex.IsMatch(element, #"^[^a-z]", RegexOption.IgnoreCase);
It will give you a sublist of all the elements that doesn't start with a letter in the range a-z.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
my problem is to get word in between first and last of a string for example string st="abcdefghi" and my problem is to get only def
substring between first 3 and last 3 chars
string substring=str.Substring(3,str.Lenghth-6)