View Single Post
Old 05-07-2020, 12:44 PM   #10
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,486
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by yamusing View Post
thanks it seems to work for the first field but the others tag fields in my other books aren't working

test: "5-glass, apple, group:95#TR4, Hefine94, weight:140lbs (acc), Z97-A.5"
result: "weight:140lbs (acc)"

test: "case:AR5steel, group:Fractal-group, heavy, T*m5%, weight:@eightySix'Kilos"
result: "case:AR5steel, group:Fractal-group, heavy, T*m5%, weight:@eightySix'Kilos"

test: case:AR5steel, light, group:Fractal-group, weight:@seventyOne'Kilos, Xeon, ZRX0, ZRX4"
result: "weight:@seventyOne'Kilos, Xeon, ZRX0"
The regular expression needs to account for the position of the desired field in the string. which can be first, middle, or last. For example:
Code:
^(.*?, *|)(weight:.+?|)(,.*?|)$
The above expression doesn't work if there isn't a "weight:...." tag somewhere in the list.

I leave it to you to figure out how to change the expression you use to delete the tag from the tag set. The change will be similar.
chaley is offline   Reply With Quote