I am trying to grab certain parts of this string:
query = SELECT distinct ?Subject ?Predicate ?Object WHERE {?Subject ?Predicate ?Object . ?Subject limo:hasGender 'man' . ?Subject limo:gender 'Chemically Castrated' . } ORDER BY ASC(?Subject)
I would like to grab all before and including "?Subject limo:hasGender" and then the period right after "man" and the rest of the string. I have tried to do something like this and various other combinations to grab it, but I'm having troubles as I am still new to using regex?
var qmatch = query.match(/(.*?\?Subject limo:hasGender) (?:.*?)(\..*?)/g
Eventually I want my end result so that I can access the data as below:
qmatch[0] = SELECT distinct ?Subject ?Predicate ?Object WHERE {?Subject ?Predicate ?Object . ?Subject limo:hasGender
qmatch[1] = . ?Subject limo:gender 'Chemically Castrated' . } ORDER BY ASC(?Subject)
Thus without the "man" value. I would normally just use a split on "man" but I cannot guarantee that will be the only occurrence of "man" in the query. This is so if I query and choose another hasGender (say woman) than I can just replace that placing(value) "man" in the string to "woman" and yet still keep the rest of the query.
Thank you for any advice anybody may have on this.