It took a lot of time to extract between the character strings, so make a note.
The front and back of the character string are fixed, and the characters in between are extracted.
Example: I want to extract the service name part from the file name and constants concatenated below COMPANY_SERVICE_OPTION * Naming convention is service company_Service name_OPTION
"COMPANY_SERVICE_OPTION".slice(/COMPANY_(.+)_OPTION/) puts $+ SERVICE
"$ +" Is a built-in variable of Ruby, and there are various other patterns. However, the following pattern 2 was used because there were some descriptions that it was deprecated.
puts "COMPANY_SERVICE_OPTION".gsub(/COMPANY_(.+)_OPTION/,'\+') SERVICE
that's all. It will be encouraging if you like and follow Qiita and Twitter! If you have any other options, I'd love to hear from you. Thanking you in advance~