How to remove quotes in between quotes using Regex? [closed] - 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 6 years ago.
Improve this question
How can one remove the quotes in between quotes using Regex?
Say for the following string:
String sb233="\"DB\"|\"FB_\"ID\"|\"INV_\"ID\"|\"%T001\"|\"%T0\"16\"|\"OWNER_KEY\"|\"VEND_LABL\"|\"INV_KEY\"|\"FB_KEY\"|\"FB_AP\"P_AMT\"|...
The desired result:
String sb233="\"DB\"|\"FB_ID\"|\"INV_ID\"|\"%T001\"|\"%T016\"|\"OWNER_KEY\"|\"VEND_LABL\"|\"INV_KEY\"|\"FB_KEY\"|\"FB_AP\"P_AMT\"|...

Try this
(?<!\||^)\\"(?!\|)
Regex Demo
Input
\"DB\"|\"FB_\"ID\"|\"INV_\"ID\"|\"%T001\"|\"%T0\"16\"|\"OWNER_KEY\"|\"VEND_LABL\"|\"INV_KEY\"|\"FB_KEY\"|\"FB_AP\"P_AMT\"|...
Output:
\"DB\"|\"FB_ID\"|\"INV_ID\"|\"%T001\"|\"%T016\"|\"OWNER_KEY\"|\"VEND_LABL\"|\"INV_KEY\"|\"FB_KEY\"|\"FB_APP_AMT\"|...

Related

How to call a method for each value in a string? [closed]

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 2 years ago.
Improve this question
I have a string like this:
var mystring = ',32,33,34,35,36'
How can I call a method for each value?
There are many ways to do that.
For ex:
foreach (string i in mystring.split(','))
callYourFunction(i);
Does this suits you?

Validation Expression - C# [closed]

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 am trying to create a validation expression for a table name in the format of:
Name_TableName_YYYYMMDD
right now I have something like this:
^[a-zA-Z0-9][^_]+[a-zA-Z0-9][^_]+\d{8}
Number at the end can read 8 digits.
You could try this (very basic) expression
[a-zA-Z]+_[a-zA-Z]+_[0-9]{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])
Link to a test

How to take char between digit and bracket? [closed]

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
We have for egz. 4.7(8+3) how add multiple character between digit and bracket4.7*(8+3)
Capture digit followed by bracket into two groups, then replace matched value with group values and multiple character between them:
Regex.Replace(input, #"(\d)(\()", "$1*$2")
For input "4.7(5+(8+3)/1(1-2))" result will be "4.7*(5+(8+3)/1*(1-2))"
Keep it simple: REplace ( by *(

How to match a string that doesnt contain a pattern [closed]

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 8 years ago.
Improve this question
I am trying to write a regex template that matches all the strings that doesn't contain a certain template.
E.g.:
Matches:
This is my friend. He is very nice.
in
This is my friend. He is very nice.
but doesn't match anything in :
This is my friend John Michaels Fredrickson. He is very nice.
Because it contains something like this: ([A-Z][a-z]+\s?){3}
You can use negative lookahead:
^(?!.*?([A-Z][a-z]+\W){3}).*$
RegEx Demo

Finding Index of in combination with RegEx [closed]

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 8 years ago.
Improve this question
I would like to find the start position of the following in a string:
{UPPERCASESTRINGINANYLENGTH(
What is the fastest way of doing that? Thanks
You can;
foreach (Match match in Regex.Matches(" {AAA(1)} {XXX(2)} ", #"\{[A-Z]+\("))
{
if (match.Success)
int pos = match.Index;

Categories