created regex to ignore .goutputstream files












0















I created a watcher with chokidar which worked properly but then now I want to ignore some files with regex but doesn't seem to be working though.



What have I done wrong with this code or regex?



here is my code



const watcher = chokidar.watch(process.env.WATCH_PATH, {
// ignored: /(^|[/\])../,
ignored: [/^.goutputstream/],
persistent: true
});


EDIT:
My bad, I wanted anything that starts with .goutputstream so could be .goutputstream-blahblahblah










share|improve this question

























  • Do you mean to match any string ending with .goutputstream? Try /.goutputstream$/

    – Wiktor Stribiżew
    Dec 31 '18 at 23:33











  • @WiktorStribiżew my bad, I edited my question and I wanted to start with instead of ending with

    – Tsuna
    Dec 31 '18 at 23:55











  • So, you wanted /^.goutputstreamb/?

    – Wiktor Stribiżew
    Dec 31 '18 at 23:56













  • @WiktorStribiżew no luck with that

    – Tsuna
    Jan 1 at 0:01











  • Please (re)read Anders Kaseorg's response, and upvote and "Accept" it if it works. As he points out, you have (at least) two issues: 1) you need to escape the period - ., 2) If .goutputstream is REALLY the beginning of the text, you can use /^.goutputstream. Otherwise, if there's a leading path, you can't.

    – paulsm4
    Jan 1 at 1:35


















0















I created a watcher with chokidar which worked properly but then now I want to ignore some files with regex but doesn't seem to be working though.



What have I done wrong with this code or regex?



here is my code



const watcher = chokidar.watch(process.env.WATCH_PATH, {
// ignored: /(^|[/\])../,
ignored: [/^.goutputstream/],
persistent: true
});


EDIT:
My bad, I wanted anything that starts with .goutputstream so could be .goutputstream-blahblahblah










share|improve this question

























  • Do you mean to match any string ending with .goutputstream? Try /.goutputstream$/

    – Wiktor Stribiżew
    Dec 31 '18 at 23:33











  • @WiktorStribiżew my bad, I edited my question and I wanted to start with instead of ending with

    – Tsuna
    Dec 31 '18 at 23:55











  • So, you wanted /^.goutputstreamb/?

    – Wiktor Stribiżew
    Dec 31 '18 at 23:56













  • @WiktorStribiżew no luck with that

    – Tsuna
    Jan 1 at 0:01











  • Please (re)read Anders Kaseorg's response, and upvote and "Accept" it if it works. As he points out, you have (at least) two issues: 1) you need to escape the period - ., 2) If .goutputstream is REALLY the beginning of the text, you can use /^.goutputstream. Otherwise, if there's a leading path, you can't.

    – paulsm4
    Jan 1 at 1:35
















0












0








0








I created a watcher with chokidar which worked properly but then now I want to ignore some files with regex but doesn't seem to be working though.



What have I done wrong with this code or regex?



here is my code



const watcher = chokidar.watch(process.env.WATCH_PATH, {
// ignored: /(^|[/\])../,
ignored: [/^.goutputstream/],
persistent: true
});


EDIT:
My bad, I wanted anything that starts with .goutputstream so could be .goutputstream-blahblahblah










share|improve this question
















I created a watcher with chokidar which worked properly but then now I want to ignore some files with regex but doesn't seem to be working though.



What have I done wrong with this code or regex?



here is my code



const watcher = chokidar.watch(process.env.WATCH_PATH, {
// ignored: /(^|[/\])../,
ignored: [/^.goutputstream/],
persistent: true
});


EDIT:
My bad, I wanted anything that starts with .goutputstream so could be .goutputstream-blahblahblah







javascript node.js regex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 23:55







Tsuna

















asked Dec 31 '18 at 23:31









TsunaTsuna

6551921




6551921













  • Do you mean to match any string ending with .goutputstream? Try /.goutputstream$/

    – Wiktor Stribiżew
    Dec 31 '18 at 23:33











  • @WiktorStribiżew my bad, I edited my question and I wanted to start with instead of ending with

    – Tsuna
    Dec 31 '18 at 23:55











  • So, you wanted /^.goutputstreamb/?

    – Wiktor Stribiżew
    Dec 31 '18 at 23:56













  • @WiktorStribiżew no luck with that

    – Tsuna
    Jan 1 at 0:01











  • Please (re)read Anders Kaseorg's response, and upvote and "Accept" it if it works. As he points out, you have (at least) two issues: 1) you need to escape the period - ., 2) If .goutputstream is REALLY the beginning of the text, you can use /^.goutputstream. Otherwise, if there's a leading path, you can't.

    – paulsm4
    Jan 1 at 1:35





















  • Do you mean to match any string ending with .goutputstream? Try /.goutputstream$/

    – Wiktor Stribiżew
    Dec 31 '18 at 23:33











  • @WiktorStribiżew my bad, I edited my question and I wanted to start with instead of ending with

    – Tsuna
    Dec 31 '18 at 23:55











  • So, you wanted /^.goutputstreamb/?

    – Wiktor Stribiżew
    Dec 31 '18 at 23:56













  • @WiktorStribiżew no luck with that

    – Tsuna
    Jan 1 at 0:01











  • Please (re)read Anders Kaseorg's response, and upvote and "Accept" it if it works. As he points out, you have (at least) two issues: 1) you need to escape the period - ., 2) If .goutputstream is REALLY the beginning of the text, you can use /^.goutputstream. Otherwise, if there's a leading path, you can't.

    – paulsm4
    Jan 1 at 1:35



















Do you mean to match any string ending with .goutputstream? Try /.goutputstream$/

– Wiktor Stribiżew
Dec 31 '18 at 23:33





Do you mean to match any string ending with .goutputstream? Try /.goutputstream$/

– Wiktor Stribiżew
Dec 31 '18 at 23:33













@WiktorStribiżew my bad, I edited my question and I wanted to start with instead of ending with

– Tsuna
Dec 31 '18 at 23:55





@WiktorStribiżew my bad, I edited my question and I wanted to start with instead of ending with

– Tsuna
Dec 31 '18 at 23:55













So, you wanted /^.goutputstreamb/?

– Wiktor Stribiżew
Dec 31 '18 at 23:56







So, you wanted /^.goutputstreamb/?

– Wiktor Stribiżew
Dec 31 '18 at 23:56















@WiktorStribiżew no luck with that

– Tsuna
Jan 1 at 0:01





@WiktorStribiżew no luck with that

– Tsuna
Jan 1 at 0:01













Please (re)read Anders Kaseorg's response, and upvote and "Accept" it if it works. As he points out, you have (at least) two issues: 1) you need to escape the period - ., 2) If .goutputstream is REALLY the beginning of the text, you can use /^.goutputstream. Otherwise, if there's a leading path, you can't.

– paulsm4
Jan 1 at 1:35







Please (re)read Anders Kaseorg's response, and upvote and "Accept" it if it works. As he points out, you have (at least) two issues: 1) you need to escape the period - ., 2) If .goutputstream is REALLY the beginning of the text, you can use /^.goutputstream. Otherwise, if there's a leading path, you can't.

– paulsm4
Jan 1 at 1:35














1 Answer
1






active

oldest

votes


















1














Two problems:





  • . matches any character, you need to write . to match (only) a period.


  • ^ only matches at the beginning of the string, but you’re probably getting some/path/.goutputstream which doesn’t match your pattern at the beginning of the string. (That’s why the commented regex began (^|[/\]), which matches either the beginning of the string, or a slash or backslash character.)






share|improve this answer
























  • what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

    – Tsuna
    Jan 3 at 1:20











  • Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

    – Anders Kaseorg
    Jan 3 at 3:14











  • sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

    – Tsuna
    Jan 3 at 22:49











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%2f53992128%2fcreated-regex-to-ignore-goutputstream-files%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









1














Two problems:





  • . matches any character, you need to write . to match (only) a period.


  • ^ only matches at the beginning of the string, but you’re probably getting some/path/.goutputstream which doesn’t match your pattern at the beginning of the string. (That’s why the commented regex began (^|[/\]), which matches either the beginning of the string, or a slash or backslash character.)






share|improve this answer
























  • what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

    – Tsuna
    Jan 3 at 1:20











  • Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

    – Anders Kaseorg
    Jan 3 at 3:14











  • sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

    – Tsuna
    Jan 3 at 22:49
















1














Two problems:





  • . matches any character, you need to write . to match (only) a period.


  • ^ only matches at the beginning of the string, but you’re probably getting some/path/.goutputstream which doesn’t match your pattern at the beginning of the string. (That’s why the commented regex began (^|[/\]), which matches either the beginning of the string, or a slash or backslash character.)






share|improve this answer
























  • what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

    – Tsuna
    Jan 3 at 1:20











  • Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

    – Anders Kaseorg
    Jan 3 at 3:14











  • sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

    – Tsuna
    Jan 3 at 22:49














1












1








1







Two problems:





  • . matches any character, you need to write . to match (only) a period.


  • ^ only matches at the beginning of the string, but you’re probably getting some/path/.goutputstream which doesn’t match your pattern at the beginning of the string. (That’s why the commented regex began (^|[/\]), which matches either the beginning of the string, or a slash or backslash character.)






share|improve this answer













Two problems:





  • . matches any character, you need to write . to match (only) a period.


  • ^ only matches at the beginning of the string, but you’re probably getting some/path/.goutputstream which doesn’t match your pattern at the beginning of the string. (That’s why the commented regex began (^|[/\]), which matches either the beginning of the string, or a slash or backslash character.)







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 1 at 1:30









Anders KaseorgAnders Kaseorg

1,780917




1,780917













  • what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

    – Tsuna
    Jan 3 at 1:20











  • Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

    – Anders Kaseorg
    Jan 3 at 3:14











  • sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

    – Tsuna
    Jan 3 at 22:49



















  • what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

    – Tsuna
    Jan 3 at 1:20











  • Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

    – Anders Kaseorg
    Jan 3 at 3:14











  • sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

    – Tsuna
    Jan 3 at 22:49

















what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

– Tsuna
Jan 3 at 1:20





what you meant is doing something like /(^|[/\]).goutputstream./ ? I always split and pop so I get the filename which would make . the beginning but doesn't really matter. The commented regex is the original sample but I do not want to ignore all . file/folder though so that's why I want to specify which to ignore.

– Tsuna
Jan 3 at 1:20













Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

– Anders Kaseorg
Jan 3 at 3:14





Well, did you try it? Note again that . matches any character, so by putting . at the end of your regex this time, you’ve told chokidar to only ignore filenames with a character after .goutputstream (i.e. .goutputstream is not at the end); is that what you meant? Also, it doesn’t matter what you do to the filename after getting it back from chokidar, with split and pop or anything else (by the way, there’s path.basename for that), because the regex test already happened.

– Anders Kaseorg
Jan 3 at 3:14













sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

– Tsuna
Jan 3 at 22:49





sryz I am really really bad with regex. Yes I have tried after I replied you but doesn't seem to help much. To make it simple as long as the string contains .goutputstream I want to ignore so if it's .goutputstream-fiDMeifnd, hello/.goutputstream-blah, .goutputstream_anything

– Tsuna
Jan 3 at 22:49




















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%2f53992128%2fcreated-regex-to-ignore-goutputstream-files%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

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas