C#. Split string with separator by regex if separator is surrounded by something The Next CEO of Stack OverflowWhat is the difference between String and string in C#?Convert a string to an enum in C#Catch multiple exceptions at once?How do you convert a byte array to a hexadecimal string, and vice versa?How do you access the matched groups in a JavaScript regular expression?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Creating a comma separated list from IList<string> or IEnumerable<string>Get property value from string using reflection in C#C# Split A String By Another StringCheck whether a string matches a regex in JS

Text adventure game code

What can we do to stop prior company from asking us questions?

If I blow insulation everywhere in my attic except the door trap, will heat escape through it?

Anatomically Correct Mesopelagic Aves

How long to clear the 'suck zone' of a turbofan after start is initiated?

WOW air has ceased operation, can I get my tickets refunded?

How easy is it to start Magic from scratch?

Are there languages with no euphemisms?

When did Lisp start using symbols for arithmetic?

Why here is plural "We went to the movies last night."

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

Return of the Riley Riddles in Reverse

How do we know the LHC results are robust?

Inappropriate reference requests from Journal reviewers

Unreliable Magic - Is it worth it?

How to Reset Passwords on Multiple Websites Easily?

How to write papers efficiently when English isn't my first language?

Science fiction (dystopian) short story set after WWIII

Can the Reverse Gravity spell affect the Meteor Swarm spell?

Why did we only see the N-1 starfighters in one film?

What does this shorthand mean?

Removing read access from a file

What do "high sea" and "carry" mean in this sentence?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?



C#. Split string with separator by regex if separator is surrounded by something



The Next CEO of Stack OverflowWhat is the difference between String and string in C#?Convert a string to an enum in C#Catch multiple exceptions at once?How do you convert a byte array to a hexadecimal string, and vice versa?How do you access the matched groups in a JavaScript regular expression?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Creating a comma separated list from IList<string> or IEnumerable<string>Get property value from string using reflection in C#C# Split A String By Another StringCheck whether a string matches a regex in JS










-3















Given string "Hello.World"
I want to get an array [ "Hello.World" ]



Given string "Hello.World"
I want to get an array [ "Hello", "World" ]










share|improve this question

















  • 2





    What do you want returned for "Hello\.World"?

    – Dour High Arch
    Mar 21 at 16:29






  • 1





    (?<!\).?

    – Ahmed Abdelhameed
    Mar 21 at 16:30






  • 1





    You want a "negative lookbehind"

    – Blorgbeard
    Mar 21 at 16:30











  • @DourHighArch the first case. I skipped @ to make it more readable. Sorry for non-obviousness

    – Herrgott
    Mar 21 at 16:35















-3















Given string "Hello.World"
I want to get an array [ "Hello.World" ]



Given string "Hello.World"
I want to get an array [ "Hello", "World" ]










share|improve this question

















  • 2





    What do you want returned for "Hello\.World"?

    – Dour High Arch
    Mar 21 at 16:29






  • 1





    (?<!\).?

    – Ahmed Abdelhameed
    Mar 21 at 16:30






  • 1





    You want a "negative lookbehind"

    – Blorgbeard
    Mar 21 at 16:30











  • @DourHighArch the first case. I skipped @ to make it more readable. Sorry for non-obviousness

    – Herrgott
    Mar 21 at 16:35













-3












-3








-3








Given string "Hello.World"
I want to get an array [ "Hello.World" ]



Given string "Hello.World"
I want to get an array [ "Hello", "World" ]










share|improve this question














Given string "Hello.World"
I want to get an array [ "Hello.World" ]



Given string "Hello.World"
I want to get an array [ "Hello", "World" ]







c# regex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 16:26









HerrgottHerrgott

210521




210521







  • 2





    What do you want returned for "Hello\.World"?

    – Dour High Arch
    Mar 21 at 16:29






  • 1





    (?<!\).?

    – Ahmed Abdelhameed
    Mar 21 at 16:30






  • 1





    You want a "negative lookbehind"

    – Blorgbeard
    Mar 21 at 16:30











  • @DourHighArch the first case. I skipped @ to make it more readable. Sorry for non-obviousness

    – Herrgott
    Mar 21 at 16:35












  • 2





    What do you want returned for "Hello\.World"?

    – Dour High Arch
    Mar 21 at 16:29






  • 1





    (?<!\).?

    – Ahmed Abdelhameed
    Mar 21 at 16:30






  • 1





    You want a "negative lookbehind"

    – Blorgbeard
    Mar 21 at 16:30











  • @DourHighArch the first case. I skipped @ to make it more readable. Sorry for non-obviousness

    – Herrgott
    Mar 21 at 16:35







2




2





What do you want returned for "Hello\.World"?

– Dour High Arch
Mar 21 at 16:29





What do you want returned for "Hello\.World"?

– Dour High Arch
Mar 21 at 16:29




1




1





(?<!\).?

– Ahmed Abdelhameed
Mar 21 at 16:30





(?<!\).?

– Ahmed Abdelhameed
Mar 21 at 16:30




1




1





You want a "negative lookbehind"

– Blorgbeard
Mar 21 at 16:30





You want a "negative lookbehind"

– Blorgbeard
Mar 21 at 16:30













@DourHighArch the first case. I skipped @ to make it more readable. Sorry for non-obviousness

– Herrgott
Mar 21 at 16:35





@DourHighArch the first case. I skipped @ to make it more readable. Sorry for non-obviousness

– Herrgott
Mar 21 at 16:35












1 Answer
1






active

oldest

votes


















2














You can use a negative lookbehind using Regex.Split()... something like:



Regex.Split(input, @"(?<!\).");


Sample fiddle






share|improve this answer




















  • 1





    Life gets harder, of course, if you want to be able to escape the escapes...

    – canton7
    Mar 21 at 16:36






  • 1





    @canton7 I don't need to escape escapes. This answer fits my needs

    – Herrgott
    Mar 21 at 16:38












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285050%2fc-split-string-with-separator-by-regex-if-separator-is-surrounded-by-something%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














You can use a negative lookbehind using Regex.Split()... something like:



Regex.Split(input, @"(?<!\).");


Sample fiddle






share|improve this answer




















  • 1





    Life gets harder, of course, if you want to be able to escape the escapes...

    – canton7
    Mar 21 at 16:36






  • 1





    @canton7 I don't need to escape escapes. This answer fits my needs

    – Herrgott
    Mar 21 at 16:38
















2














You can use a negative lookbehind using Regex.Split()... something like:



Regex.Split(input, @"(?<!\).");


Sample fiddle






share|improve this answer




















  • 1





    Life gets harder, of course, if you want to be able to escape the escapes...

    – canton7
    Mar 21 at 16:36






  • 1





    @canton7 I don't need to escape escapes. This answer fits my needs

    – Herrgott
    Mar 21 at 16:38














2












2








2







You can use a negative lookbehind using Regex.Split()... something like:



Regex.Split(input, @"(?<!\).");


Sample fiddle






share|improve this answer















You can use a negative lookbehind using Regex.Split()... something like:



Regex.Split(input, @"(?<!\).");


Sample fiddle







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 21 at 16:36

























answered Mar 21 at 16:35









JclJcl

20.6k24266




20.6k24266







  • 1





    Life gets harder, of course, if you want to be able to escape the escapes...

    – canton7
    Mar 21 at 16:36






  • 1





    @canton7 I don't need to escape escapes. This answer fits my needs

    – Herrgott
    Mar 21 at 16:38













  • 1





    Life gets harder, of course, if you want to be able to escape the escapes...

    – canton7
    Mar 21 at 16:36






  • 1





    @canton7 I don't need to escape escapes. This answer fits my needs

    – Herrgott
    Mar 21 at 16:38








1




1





Life gets harder, of course, if you want to be able to escape the escapes...

– canton7
Mar 21 at 16:36





Life gets harder, of course, if you want to be able to escape the escapes...

– canton7
Mar 21 at 16:36




1




1





@canton7 I don't need to escape escapes. This answer fits my needs

– Herrgott
Mar 21 at 16:38






@canton7 I don't need to escape escapes. This answer fits my needs

– Herrgott
Mar 21 at 16:38




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285050%2fc-split-string-with-separator-by-regex-if-separator-is-surrounded-by-something%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript