java - Create regex based on variables -
i having bit of trouble creating regex database query doing. im using accumulo database (which doesn't matter @ point). in accumulo row looks like:
rowid columnfamily : columnqualifier [ ] value
and allowed pattern match on each of 4 iterator. having trouble trying come pattern match rowid
. entire row looks this
2beab7b3-0792-4347-a63b-3e2f3c6b048d.4ce7be2a-fb2e-4694-94db-877a0ed3e68b.edd1918d-9ddc-4597-891a-d12c8c7be602.1445442700588 transaction:occurrences [] @\x18\x00\x00\x00\x00\x00\x00
where rowid
trying match looks like:
2beab7b3-0792-4347-a63b-3e2f3c6b048d.4ce7be2a-fb2e-4694-94db-877a0ed3e68b.edd1918d-9ddc-4597-891a-d12c8c7be602.1445442700588
this unique key created using 3 other keys (from 3 objects) , timestamp separated .
. have this:
2beab7b3-0792-4347-a63b-3e2f3c6b048d //key 1 method below 4ce7be2a-fb2e-4694-94db-877a0ed3e68b //dont care key edd1918d-9ddc-4597-891a-d12c8c7be602 //key 3 method below 1445442700588 //dont care timestamp
the method working this:
public blah getblah(string key1, string key3){ //do regex stuff }
where key1
first section of greater key (shown above) , key3
third part of greater key (also shown above).
so boils down fact know 2 parts of 4 part compound key in same form, , need create regex or pattern matcher find out when first , third part of key match inputs of method getblah()
.
edit
the catch in accumulo (for case @ least) building regex for query basically. when method getblah(string k1, string k2)
called, won't have queried database yet won't know whole key or row looks like. query select statement in case. go through entire table , @ rowid
's pattern happens match, , pull down of matches. need able use method dynamically match pattern of rowid
s without knowing them before hand.
so rowid
s in form of xxxxxxx.xxxxxxx.xxxxxxx.xxxxxxx
, keys passed method represent first , third set of x's.
how this, , please correct me if i'm wrong
key1\..*\.key3
or
\\.([a-z0-9-])*\\." + k2 + "\\.[0-9]*
if have k2 variable
if try match pattern on rowid column, think should give correct row
Comments
Post a Comment