how to return a string with findstr in windows with matching substring










2















I have a string in a file like,



async.AsyncTranslationThread - processPart: Finished Processing job number: J215577 partID: 151269


any many more.



I want to return only that line which has substring Finished Processing job number



I wrote a findstr command with regex like



findstr /R "^.*FinishedsProcessingsjobsnumber.*$" filename


I am getting nothing in return, what would be the change in regex to get the string with substring in it?










share|improve this question






















  • If you found my answer helpful, please accept it to mark the question as closed :)

    – Addison
    Nov 14 '18 at 5:15















2















I have a string in a file like,



async.AsyncTranslationThread - processPart: Finished Processing job number: J215577 partID: 151269


any many more.



I want to return only that line which has substring Finished Processing job number



I wrote a findstr command with regex like



findstr /R "^.*FinishedsProcessingsjobsnumber.*$" filename


I am getting nothing in return, what would be the change in regex to get the string with substring in it?










share|improve this question






















  • If you found my answer helpful, please accept it to mark the question as closed :)

    – Addison
    Nov 14 '18 at 5:15













2












2








2








I have a string in a file like,



async.AsyncTranslationThread - processPart: Finished Processing job number: J215577 partID: 151269


any many more.



I want to return only that line which has substring Finished Processing job number



I wrote a findstr command with regex like



findstr /R "^.*FinishedsProcessingsjobsnumber.*$" filename


I am getting nothing in return, what would be the change in regex to get the string with substring in it?










share|improve this question














I have a string in a file like,



async.AsyncTranslationThread - processPart: Finished Processing job number: J215577 partID: 151269


any many more.



I want to return only that line which has substring Finished Processing job number



I wrote a findstr command with regex like



findstr /R "^.*FinishedsProcessingsjobsnumber.*$" filename


I am getting nothing in return, what would be the change in regex to get the string with substring in it?







regex findstr






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 '18 at 0:17









Laxmi KadariyaLaxmi Kadariya

6271822




6271822












  • If you found my answer helpful, please accept it to mark the question as closed :)

    – Addison
    Nov 14 '18 at 5:15

















  • If you found my answer helpful, please accept it to mark the question as closed :)

    – Addison
    Nov 14 '18 at 5:15
















If you found my answer helpful, please accept it to mark the question as closed :)

– Addison
Nov 14 '18 at 5:15





If you found my answer helpful, please accept it to mark the question as closed :)

– Addison
Nov 14 '18 at 5:15












1 Answer
1






active

oldest

votes


















2














If you take a look at the documentation, findstr doesn't support most traditional regex features, such as s, which you are using. It doesn't even support the + quantifier!




The following table lists the metacharacters that findstr accepts.



| Meta Character | Value
| . | Wildcard: any character
| * | Repeat: zero or more occurrences of the previous character or class
| ^ | Line position: beginning of the line
| $ | Line position: end of the line
| [class] | Character class: any one character in a set
| [^class] | Inverse class: any one character not in a set
| [x-y] | Range: any characters within the specified range
| x | Escape: literal use of a metacharacter x
| <string | Word position: beginning of the word
| string> | Word position: end of the word



You can easily get away with this, and it'll still accept it if even there are multiple spaces or tabs:



findstr /c:"Finished Processing job number" filename


Furthermore, it seems that it's not even case sensitive by default






share|improve this answer

























  • this will match single word as well. I want to have only the line which has all this word in it.

    – Laxmi Kadariya
    Nov 14 '18 at 16:58











  • @LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

    – Addison
    Nov 14 '18 at 23:37










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%2f53199838%2fhow-to-return-a-string-with-findstr-in-windows-with-matching-substring%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














If you take a look at the documentation, findstr doesn't support most traditional regex features, such as s, which you are using. It doesn't even support the + quantifier!




The following table lists the metacharacters that findstr accepts.



| Meta Character | Value
| . | Wildcard: any character
| * | Repeat: zero or more occurrences of the previous character or class
| ^ | Line position: beginning of the line
| $ | Line position: end of the line
| [class] | Character class: any one character in a set
| [^class] | Inverse class: any one character not in a set
| [x-y] | Range: any characters within the specified range
| x | Escape: literal use of a metacharacter x
| <string | Word position: beginning of the word
| string> | Word position: end of the word



You can easily get away with this, and it'll still accept it if even there are multiple spaces or tabs:



findstr /c:"Finished Processing job number" filename


Furthermore, it seems that it's not even case sensitive by default






share|improve this answer

























  • this will match single word as well. I want to have only the line which has all this word in it.

    – Laxmi Kadariya
    Nov 14 '18 at 16:58











  • @LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

    – Addison
    Nov 14 '18 at 23:37















2














If you take a look at the documentation, findstr doesn't support most traditional regex features, such as s, which you are using. It doesn't even support the + quantifier!




The following table lists the metacharacters that findstr accepts.



| Meta Character | Value
| . | Wildcard: any character
| * | Repeat: zero or more occurrences of the previous character or class
| ^ | Line position: beginning of the line
| $ | Line position: end of the line
| [class] | Character class: any one character in a set
| [^class] | Inverse class: any one character not in a set
| [x-y] | Range: any characters within the specified range
| x | Escape: literal use of a metacharacter x
| <string | Word position: beginning of the word
| string> | Word position: end of the word



You can easily get away with this, and it'll still accept it if even there are multiple spaces or tabs:



findstr /c:"Finished Processing job number" filename


Furthermore, it seems that it's not even case sensitive by default






share|improve this answer

























  • this will match single word as well. I want to have only the line which has all this word in it.

    – Laxmi Kadariya
    Nov 14 '18 at 16:58











  • @LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

    – Addison
    Nov 14 '18 at 23:37













2












2








2







If you take a look at the documentation, findstr doesn't support most traditional regex features, such as s, which you are using. It doesn't even support the + quantifier!




The following table lists the metacharacters that findstr accepts.



| Meta Character | Value
| . | Wildcard: any character
| * | Repeat: zero or more occurrences of the previous character or class
| ^ | Line position: beginning of the line
| $ | Line position: end of the line
| [class] | Character class: any one character in a set
| [^class] | Inverse class: any one character not in a set
| [x-y] | Range: any characters within the specified range
| x | Escape: literal use of a metacharacter x
| <string | Word position: beginning of the word
| string> | Word position: end of the word



You can easily get away with this, and it'll still accept it if even there are multiple spaces or tabs:



findstr /c:"Finished Processing job number" filename


Furthermore, it seems that it's not even case sensitive by default






share|improve this answer















If you take a look at the documentation, findstr doesn't support most traditional regex features, such as s, which you are using. It doesn't even support the + quantifier!




The following table lists the metacharacters that findstr accepts.



| Meta Character | Value
| . | Wildcard: any character
| * | Repeat: zero or more occurrences of the previous character or class
| ^ | Line position: beginning of the line
| $ | Line position: end of the line
| [class] | Character class: any one character in a set
| [^class] | Inverse class: any one character not in a set
| [x-y] | Range: any characters within the specified range
| x | Escape: literal use of a metacharacter x
| <string | Word position: beginning of the word
| string> | Word position: end of the word



You can easily get away with this, and it'll still accept it if even there are multiple spaces or tabs:



findstr /c:"Finished Processing job number" filename


Furthermore, it seems that it's not even case sensitive by default







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 14 '18 at 23:36

























answered Nov 14 '18 at 3:12









AddisonAddison

1,5641834




1,5641834












  • this will match single word as well. I want to have only the line which has all this word in it.

    – Laxmi Kadariya
    Nov 14 '18 at 16:58











  • @LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

    – Addison
    Nov 14 '18 at 23:37

















  • this will match single word as well. I want to have only the line which has all this word in it.

    – Laxmi Kadariya
    Nov 14 '18 at 16:58











  • @LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

    – Addison
    Nov 14 '18 at 23:37
















this will match single word as well. I want to have only the line which has all this word in it.

– Laxmi Kadariya
Nov 14 '18 at 16:58





this will match single word as well. I want to have only the line which has all this word in it.

– Laxmi Kadariya
Nov 14 '18 at 16:58













@LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

– Addison
Nov 14 '18 at 23:37





@LaxmiKadariya Sorry, I missed an option - /c:<string> - Uses the specified text as a literal search string.

– Addison
Nov 14 '18 at 23:37

















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%2f53199838%2fhow-to-return-a-string-with-findstr-in-windows-with-matching-substring%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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3