Regex pattern to parse path with tabs and newlines?Regex Named Groups in JavaMatch all occurrences of a regexA comprehensive regex for phone number validationHow to negate specific word in regex?RegEx match open tags except XHTML self-contained tagsHow to parse JSON in JavaRegex Pattern to Match, Excluding when… / Except betweenregex multiline not working on repeated patternsRegex multiple capture groups on same patternRegex to identify a full path nameRegex matching lines with escaped new line character
How to determine what difficulty is right for the game?
How to draw a waving flag in TikZ
Watching something be written to a file live with tail
How do I deal with an unproductive colleague in a small company?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Languages that we cannot (dis)prove to be Context-Free
What's that red-plus icon near a text?
Could an aircraft fly or hover using only jets of compressed air?
Why does Kotter return in Welcome Back Kotter?
Approximately how much travel time was saved by the opening of the Suez Canal in 1869?
Is it legal for company to use my work email to pretend I still work there?
Important Resources for Dark Age Civilizations?
Convert two switches to a dual stack, and add outlet - possible here?
Why are electrically insulating heatsinks so rare? Is it just cost?
"You are your self first supporter", a more proper way to say it
High voltage LED indicator 40-1000 VDC without additional power supply
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function
Why doesn't H₄O²⁺ exist?
Malcev's paper "On a class of homogeneous spaces" in English
Character reincarnated...as a snail
How old can references or sources in a thesis be?
Did Shadowfax go to Valinor?
Regex pattern to parse path with tabs and newlines?
Regex Named Groups in JavaMatch all occurrences of a regexA comprehensive regex for phone number validationHow to negate specific word in regex?RegEx match open tags except XHTML self-contained tagsHow to parse JSON in JavaRegex Pattern to Match, Excluding when… / Except betweenregex multiline not working on repeated patternsRegex multiple capture groups on same patternRegex to identify a full path nameRegex matching lines with escaped new line character
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've a path dirntsubdir1ntsubdir2nttfile.ext
that I want to process one segment at a time. For each segment, I want to know how many tabs precede it, and I want to have the rest of the path intact. For the given example
Iteration 1:
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
Iteration 2:
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
Iteration 3:
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
Iteration 4:
Preceding tabs: 2
Segment: file.ext
Rest: ""
The pattern I came up with is ((?<=\R)\h*)(\H+)
. However, that is giving me tsubdir1n
as the first match. What am I doing wrong?
java regex regex-lookarounds regex-group
add a comment |
I've a path dirntsubdir1ntsubdir2nttfile.ext
that I want to process one segment at a time. For each segment, I want to know how many tabs precede it, and I want to have the rest of the path intact. For the given example
Iteration 1:
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
Iteration 2:
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
Iteration 3:
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
Iteration 4:
Preceding tabs: 2
Segment: file.ext
Rest: ""
The pattern I came up with is ((?<=\R)\h*)(\H+)
. However, that is giving me tsubdir1n
as the first match. What am I doing wrong?
java regex regex-lookarounds regex-group
add a comment |
I've a path dirntsubdir1ntsubdir2nttfile.ext
that I want to process one segment at a time. For each segment, I want to know how many tabs precede it, and I want to have the rest of the path intact. For the given example
Iteration 1:
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
Iteration 2:
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
Iteration 3:
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
Iteration 4:
Preceding tabs: 2
Segment: file.ext
Rest: ""
The pattern I came up with is ((?<=\R)\h*)(\H+)
. However, that is giving me tsubdir1n
as the first match. What am I doing wrong?
java regex regex-lookarounds regex-group
I've a path dirntsubdir1ntsubdir2nttfile.ext
that I want to process one segment at a time. For each segment, I want to know how many tabs precede it, and I want to have the rest of the path intact. For the given example
Iteration 1:
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
Iteration 2:
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
Iteration 3:
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
Iteration 4:
Preceding tabs: 2
Segment: file.ext
Rest: ""
The pattern I came up with is ((?<=\R)\h*)(\H+)
. However, that is giving me tsubdir1n
as the first match. What am I doing wrong?
java regex regex-lookarounds regex-group
java regex regex-lookarounds regex-group
asked Mar 8 at 2:17
Abhijit SarkarAbhijit Sarkar
7,77474396
7,77474396
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Since all sections are separated by line separator n
you can simply use .+
to match them since by default dot .
can't match line separators, so you are sure that it will stop before n
(or any other line separator like r
).
You can also add some groups to separate tabs from actual segment like named group (?<tabs>t*)
to match zero or more tabs at start of each match.
To print rest of text after match simply substring after index of last matched character (you can obtain it via Matcher#end
).
To print string which will contain n
and t
(not as literals but as pair of backslash and letter) you can either manually replace each "n"
with "\n"
and "t"
with "\t"
or use utility class like StringEscapeUtils
from org.apache.commons.lang
which contains escapeJava
method which does it for us.
So your code can look like:
String path = "dirntsubdir1ntsubdir2nttfile.ext";
Pattern p = Pattern.compile("(?<tabs>t*)(?<segment>.+)");//dot can't match line separators
Matcher m = p.matcher(path);
int i = 1;
while(m.find())
System.out.println("iteration: " + i++);
System.out.println("Preceding tabs: " + (m.group("tabs").length()));
System.out.println("Segment: " + m.group("segment"));
System.out.println("Rest: "+ StringEscapeUtils.escapeJava(path.substring(m.end())));
System.out.println();
Output:
iteration: 1
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
iteration: 2
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
iteration: 3
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
iteration: 4
Preceding tabs: 2
Segment: file.ext
Rest:
Couple of comments: 1)StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally printn
, replace with\\n
, not\n
.
– Abhijit Sarkar
Mar 9 at 6:42
1
@AbhijitSarkar (1) thanks for update, (2) only if you are usingreplaceAll
which supports regex where is metacharecter and require additional escaping. But if you usereplace
which doesn't support regex syntax and also replaces all matchesreplace("n", "\n")
should work fine.
– Pshemo
Mar 9 at 10:28
You're correct, aboutreplace
. Can it be any more confusing, that bothreplace
andreplaceAll
actually replace all?
– Abhijit Sarkar
Mar 9 at 20:42
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behindAll
suffix is that it emphasize difference between it andreplaceFrist
which also supports regex syntax. Confusing part is that other replacing methods:replace(char target, char replacement)
andreplace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences oftarget
.
– Pshemo
Mar 9 at 22:24
Alternative names could bereplaceRegex
andreplaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.
– Pshemo
Mar 9 at 22:29
|
show 3 more comments
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055788%2fregex-pattern-to-parse-path-with-tabs-and-newlines%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
Since all sections are separated by line separator n
you can simply use .+
to match them since by default dot .
can't match line separators, so you are sure that it will stop before n
(or any other line separator like r
).
You can also add some groups to separate tabs from actual segment like named group (?<tabs>t*)
to match zero or more tabs at start of each match.
To print rest of text after match simply substring after index of last matched character (you can obtain it via Matcher#end
).
To print string which will contain n
and t
(not as literals but as pair of backslash and letter) you can either manually replace each "n"
with "\n"
and "t"
with "\t"
or use utility class like StringEscapeUtils
from org.apache.commons.lang
which contains escapeJava
method which does it for us.
So your code can look like:
String path = "dirntsubdir1ntsubdir2nttfile.ext";
Pattern p = Pattern.compile("(?<tabs>t*)(?<segment>.+)");//dot can't match line separators
Matcher m = p.matcher(path);
int i = 1;
while(m.find())
System.out.println("iteration: " + i++);
System.out.println("Preceding tabs: " + (m.group("tabs").length()));
System.out.println("Segment: " + m.group("segment"));
System.out.println("Rest: "+ StringEscapeUtils.escapeJava(path.substring(m.end())));
System.out.println();
Output:
iteration: 1
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
iteration: 2
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
iteration: 3
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
iteration: 4
Preceding tabs: 2
Segment: file.ext
Rest:
Couple of comments: 1)StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally printn
, replace with\\n
, not\n
.
– Abhijit Sarkar
Mar 9 at 6:42
1
@AbhijitSarkar (1) thanks for update, (2) only if you are usingreplaceAll
which supports regex where is metacharecter and require additional escaping. But if you usereplace
which doesn't support regex syntax and also replaces all matchesreplace("n", "\n")
should work fine.
– Pshemo
Mar 9 at 10:28
You're correct, aboutreplace
. Can it be any more confusing, that bothreplace
andreplaceAll
actually replace all?
– Abhijit Sarkar
Mar 9 at 20:42
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behindAll
suffix is that it emphasize difference between it andreplaceFrist
which also supports regex syntax. Confusing part is that other replacing methods:replace(char target, char replacement)
andreplace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences oftarget
.
– Pshemo
Mar 9 at 22:24
Alternative names could bereplaceRegex
andreplaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.
– Pshemo
Mar 9 at 22:29
|
show 3 more comments
Since all sections are separated by line separator n
you can simply use .+
to match them since by default dot .
can't match line separators, so you are sure that it will stop before n
(or any other line separator like r
).
You can also add some groups to separate tabs from actual segment like named group (?<tabs>t*)
to match zero or more tabs at start of each match.
To print rest of text after match simply substring after index of last matched character (you can obtain it via Matcher#end
).
To print string which will contain n
and t
(not as literals but as pair of backslash and letter) you can either manually replace each "n"
with "\n"
and "t"
with "\t"
or use utility class like StringEscapeUtils
from org.apache.commons.lang
which contains escapeJava
method which does it for us.
So your code can look like:
String path = "dirntsubdir1ntsubdir2nttfile.ext";
Pattern p = Pattern.compile("(?<tabs>t*)(?<segment>.+)");//dot can't match line separators
Matcher m = p.matcher(path);
int i = 1;
while(m.find())
System.out.println("iteration: " + i++);
System.out.println("Preceding tabs: " + (m.group("tabs").length()));
System.out.println("Segment: " + m.group("segment"));
System.out.println("Rest: "+ StringEscapeUtils.escapeJava(path.substring(m.end())));
System.out.println();
Output:
iteration: 1
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
iteration: 2
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
iteration: 3
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
iteration: 4
Preceding tabs: 2
Segment: file.ext
Rest:
Couple of comments: 1)StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally printn
, replace with\\n
, not\n
.
– Abhijit Sarkar
Mar 9 at 6:42
1
@AbhijitSarkar (1) thanks for update, (2) only if you are usingreplaceAll
which supports regex where is metacharecter and require additional escaping. But if you usereplace
which doesn't support regex syntax and also replaces all matchesreplace("n", "\n")
should work fine.
– Pshemo
Mar 9 at 10:28
You're correct, aboutreplace
. Can it be any more confusing, that bothreplace
andreplaceAll
actually replace all?
– Abhijit Sarkar
Mar 9 at 20:42
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behindAll
suffix is that it emphasize difference between it andreplaceFrist
which also supports regex syntax. Confusing part is that other replacing methods:replace(char target, char replacement)
andreplace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences oftarget
.
– Pshemo
Mar 9 at 22:24
Alternative names could bereplaceRegex
andreplaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.
– Pshemo
Mar 9 at 22:29
|
show 3 more comments
Since all sections are separated by line separator n
you can simply use .+
to match them since by default dot .
can't match line separators, so you are sure that it will stop before n
(or any other line separator like r
).
You can also add some groups to separate tabs from actual segment like named group (?<tabs>t*)
to match zero or more tabs at start of each match.
To print rest of text after match simply substring after index of last matched character (you can obtain it via Matcher#end
).
To print string which will contain n
and t
(not as literals but as pair of backslash and letter) you can either manually replace each "n"
with "\n"
and "t"
with "\t"
or use utility class like StringEscapeUtils
from org.apache.commons.lang
which contains escapeJava
method which does it for us.
So your code can look like:
String path = "dirntsubdir1ntsubdir2nttfile.ext";
Pattern p = Pattern.compile("(?<tabs>t*)(?<segment>.+)");//dot can't match line separators
Matcher m = p.matcher(path);
int i = 1;
while(m.find())
System.out.println("iteration: " + i++);
System.out.println("Preceding tabs: " + (m.group("tabs").length()));
System.out.println("Segment: " + m.group("segment"));
System.out.println("Rest: "+ StringEscapeUtils.escapeJava(path.substring(m.end())));
System.out.println();
Output:
iteration: 1
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
iteration: 2
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
iteration: 3
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
iteration: 4
Preceding tabs: 2
Segment: file.ext
Rest:
Since all sections are separated by line separator n
you can simply use .+
to match them since by default dot .
can't match line separators, so you are sure that it will stop before n
(or any other line separator like r
).
You can also add some groups to separate tabs from actual segment like named group (?<tabs>t*)
to match zero or more tabs at start of each match.
To print rest of text after match simply substring after index of last matched character (you can obtain it via Matcher#end
).
To print string which will contain n
and t
(not as literals but as pair of backslash and letter) you can either manually replace each "n"
with "\n"
and "t"
with "\t"
or use utility class like StringEscapeUtils
from org.apache.commons.lang
which contains escapeJava
method which does it for us.
So your code can look like:
String path = "dirntsubdir1ntsubdir2nttfile.ext";
Pattern p = Pattern.compile("(?<tabs>t*)(?<segment>.+)");//dot can't match line separators
Matcher m = p.matcher(path);
int i = 1;
while(m.find())
System.out.println("iteration: " + i++);
System.out.println("Preceding tabs: " + (m.group("tabs").length()));
System.out.println("Segment: " + m.group("segment"));
System.out.println("Rest: "+ StringEscapeUtils.escapeJava(path.substring(m.end())));
System.out.println();
Output:
iteration: 1
Preceding tabs: 0
Segment: dir
Rest: ntsubdir1ntsubdir2nttfile.ext
iteration: 2
Preceding tabs: 1
Segment: subdir1
Rest: ntsubdir2nttfile.ext
iteration: 3
Preceding tabs: 1
Segment: subdir2
Rest: nttfile.ext
iteration: 4
Preceding tabs: 2
Segment: file.ext
Rest:
edited Mar 8 at 14:03
answered Mar 8 at 2:49
PshemoPshemo
96.1k15134194
96.1k15134194
Couple of comments: 1)StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally printn
, replace with\\n
, not\n
.
– Abhijit Sarkar
Mar 9 at 6:42
1
@AbhijitSarkar (1) thanks for update, (2) only if you are usingreplaceAll
which supports regex where is metacharecter and require additional escaping. But if you usereplace
which doesn't support regex syntax and also replaces all matchesreplace("n", "\n")
should work fine.
– Pshemo
Mar 9 at 10:28
You're correct, aboutreplace
. Can it be any more confusing, that bothreplace
andreplaceAll
actually replace all?
– Abhijit Sarkar
Mar 9 at 20:42
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behindAll
suffix is that it emphasize difference between it andreplaceFrist
which also supports regex syntax. Confusing part is that other replacing methods:replace(char target, char replacement)
andreplace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences oftarget
.
– Pshemo
Mar 9 at 22:24
Alternative names could bereplaceRegex
andreplaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.
– Pshemo
Mar 9 at 22:29
|
show 3 more comments
Couple of comments: 1)StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally printn
, replace with\\n
, not\n
.
– Abhijit Sarkar
Mar 9 at 6:42
1
@AbhijitSarkar (1) thanks for update, (2) only if you are usingreplaceAll
which supports regex where is metacharecter and require additional escaping. But if you usereplace
which doesn't support regex syntax and also replaces all matchesreplace("n", "\n")
should work fine.
– Pshemo
Mar 9 at 10:28
You're correct, aboutreplace
. Can it be any more confusing, that bothreplace
andreplaceAll
actually replace all?
– Abhijit Sarkar
Mar 9 at 20:42
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behindAll
suffix is that it emphasize difference between it andreplaceFrist
which also supports regex syntax. Confusing part is that other replacing methods:replace(char target, char replacement)
andreplace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences oftarget
.
– Pshemo
Mar 9 at 22:24
Alternative names could bereplaceRegex
andreplaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.
– Pshemo
Mar 9 at 22:29
Couple of comments: 1)
StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally print n
, replace with \\n
, not \n
.– Abhijit Sarkar
Mar 9 at 6:42
Couple of comments: 1)
StringEscapeUtils
is now in commons-text, the one in commons-lang has been deprecated. 2) To literally print n
, replace with \\n
, not \n
.– Abhijit Sarkar
Mar 9 at 6:42
1
1
@AbhijitSarkar (1) thanks for update, (2) only if you are using
replaceAll
which supports regex where is metacharecter and require additional escaping. But if you use replace
which doesn't support regex syntax and also replaces all matches replace("n", "\n")
should work fine.– Pshemo
Mar 9 at 10:28
@AbhijitSarkar (1) thanks for update, (2) only if you are using
replaceAll
which supports regex where is metacharecter and require additional escaping. But if you use replace
which doesn't support regex syntax and also replaces all matches replace("n", "\n")
should work fine.– Pshemo
Mar 9 at 10:28
You're correct, about
replace
. Can it be any more confusing, that both replace
and replaceAll
actually replace all?– Abhijit Sarkar
Mar 9 at 20:42
You're correct, about
replace
. Can it be any more confusing, that both replace
and replaceAll
actually replace all?– Abhijit Sarkar
Mar 9 at 20:42
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behind
All
suffix is that it emphasize difference between it and replaceFrist
which also supports regex syntax. Confusing part is that other replacing methods: replace(char target, char replacement)
and replace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences of target
.– Pshemo
Mar 9 at 22:24
@AbhijitSarkar Yes, naming of replacing methods is confusing. Probable rationale behind
All
suffix is that it emphasize difference between it and replaceFrist
which also supports regex syntax. Confusing part is that other replacing methods: replace(char target, char replacement)
and replace(CharSequence target, CharSequence replacement)
don't use regex but also replace all occurrences of target
.– Pshemo
Mar 9 at 22:24
Alternative names could be
replaceRegex
and replaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.– Pshemo
Mar 9 at 22:29
Alternative names could be
replaceRegex
and replaceFirstRegex
which IMO would be less confusing but some could say that these names could be too long (which IMO is not the case since IDE would suggest them and people would autocomplete them, so we wouldn't really need more keystrokes). But that is just my opinion.– Pshemo
Mar 9 at 22:29
|
show 3 more comments
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055788%2fregex-pattern-to-parse-path-with-tabs-and-newlines%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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