Web Hosting, Design, & Coding forum


Batch: extract text using reg exp in windows bat file

by bkorn21 / July 7, 2013 6:21 AM PDT

Howdy! Novice question:

I can use the following regular expression


in textcrawler (a gui based Windows grep program) to extract text in between two brackets into another file. it works beautifully.

However, I need to be able to do that from a Windows bat file. Something like

grep (?<=\[)(.*?)(?=\]) myinput.txt >myoutput.txt (well..you get the idea)

I have tried numerous versions of command line grep programs for windows, but just cannot for the life of me find one that works (or more accurately, figure out the syntax to go get it to work.)

(sometimes just putting the reg expression in a bat file screws up the processing, so it sound like I need syntax help)

Thanks in advance...

Answer This Ask For Clarification
Discussion is locked
You are posting a reply to: Batch: extract text using reg exp in windows bat file
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Batch: extract text using reg exp in windows bat file
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Popular Forums
Computer Help 49,613 discussions
Computer Newbies 10,349 discussions
Laptops 19,436 discussions
Security 30,426 discussions
TVs & Home Theaters 20,308 discussions
Windows 10 360 discussions
Phones 15,802 discussions
Windows 7 7,351 discussions
Networking & Wireless 14,641 discussions


Big screens for the big game

Still looking for the best TV deals ahead of Sunday's game? Here are our top three big screen picks.