login about faq

Due to the large amount of spam accounts, we temporarily disabled new user sign ups. To override this, email newuser.lgqa@gmail.com and an admin will determine if you are permitted to join


asked Jun 05 '12 at 09:51

RafalChmiel's gravatar image

RafalChmiel
491138151156


I mostly use it when writing bash scripts and need to search or replace some text that may or may not contain variable characters or digits or words (etc.).

RegEx is mostly useful for pattern matching and so it's a pretty irreplaceable tool for programmers.

I have a script for instance that grabs a list of youtube video IDs via the gdata.youtube api to be downloaded by youtube-dl (a python script/application). I like my stuff to be automatically organized so I put the list of IDs in an already made folder for that playlist. To name the folder I grab the html the api produces for my script and then run it through with 'grep -o "<title>.*</title>"' where it searches for the html title element tags and then I can format that text in between the tags to be used for my folder name.

The same concept gets reused for finding the video ID tags too. And despite my usage, it can be built the same way if you wanted to build an Android/iOS app that searched youtube for videos.

I tend to mostly write scripts that make use of the wildcard (.* for instance, which will select any characters for as many times before it reaches the end) features of regex, but if I were managing a database or search engine or some other high variable data, there are all sorts of possible uses for regex.

answered Jun 05 '12 at 15:47

Kris's gravatar image

Kris
32626

edited Jun 05 '12 at 15:54

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported


Join Us in the Chat Room

Tags:

×355
×298
×150
×113
×21
×4

Asked: Jun 05 '12 at 09:51

Seen: 349 times

Last updated: Jun 05 '12 at 15:54