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 47,885 discussions
Computer Newbies 10,322 discussions
iPhones, iPods, & iPads 3,188 discussions
Security 30,333 discussions
TVs & Home Theaters 20,177 discussions
HDTV Picture Setting 1,932 discussions
Phones 15,713 discussions
Windows 7 6,210 discussions
Networking & Wireless 14,510 discussions

Big stars on small screens

Smosh tells CNET what it took to make it big online

Internet sensations Ian Hecox and Anthony Padilla discuss how YouTube has changed and why among all their goals, "real TV" isn't an ambition.