title: Regular Expressions and Variables
body: <p>I am new with working with regular expressions. While I understand most of the basics, I am curious about ways to extract variables out of a regular expression. I have tried googling it but I come short each time. </p>
  
  <p>What I am trying to do is parse out an arbitrary number of string words out of a line of regex. The length or general sytax is undefined to my parser. The delimeter between each word is also unknown. Linux Bash scripting uses ${variablename}</p>
  
  <p>Examples:
  User Defined RegEx:
  "<em>[a-zA-Z0-9]</em>${variable1}<em>.*</em>${variable2}<em>...</em>([0-9]+)_${variable3}"</p>
  
  <p>I want the user to define the regex of the string I am going to parse out. I want them to set which items are the variables that I care about. I can verify later that an input string matches this regex, and then pull out anything flagged as ${} as a variable. 
  Later, once my program has received the user defined regex above, it will begin to take String inputs:</p>
  
  <p>"_hello12_world_randomjunk12345$#!_wide_123_96584_web"
  this input will match the regex and I will be able to pull out:
  world as variable1
  wide as variable2
  web as variable3</p>
  
  <p>My actual question: Does regex have a general syntax that handles variables inside a regex instead of the ${} that I have written above? ${} is a bash scripting thing and I can create it in my program if I have to, I just want to make sure I am not reinventing the wheel.</p>