1

I'm a beginner with regex Basically what I have on the line of my file is:

grails.plugin.springsecurity.xxx.dtes.sp.file = '/home/share/9WR/config/application1-t-sp.html'   // for unix file based

And I want to get the path and the file that is referencing:

/home/share/9WR/config/application1-t-sp.html

Is there a way to do this with regex?

  • Is filename fixed ? or is it any .html file to identify ? if so a simple regexp can do the spot. – francois P Mar 12 at 18:38
  • it could be any html file to identify. I found this, but not sure if is the best solution: ``` (?:^|\s)'([^']*?)'(?:\s|$) ``` – coque Mar 12 at 19:06
1

Instead of regex the ini plugin might be a better choice. For example, given the file

shell> cat test.ini 
grails.plugin.springsecurity.xxx.dtes.sp.file = '/home/share/9WR/config/application1-t-sp.html'   // for unix file based

the task

    - debug:
        msg: "{{ lookup('ini',
                        'grails.plugin.springsecurity.xxx.dtes.sp.file
                        type=properties
                        file=test.ini') }}"

gives

"msg": "'/home/share/9WR/config/application1-t-sp.html'   // for unix file based"


Notes

  • lookup works with local files only
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.