I have a field named 'parameter' in table with below format
utf8: "\xE2\x9C\x93"
id: "805265"
plan: initial
acc: "123456"
last: "1234"
doc: "1281468479"
validation: field
commit: Accept
how to query 'acc' value from the table?
database :sequelPro
I have a field named 'parameter' in table with below format
utf8: "\xE2\x9C\x93"
id: "805265"
plan: initial
acc: "123456"
last: "1234"
doc: "1281468479"
validation: field
commit: Accept
how to query 'acc' value from the table?
database :sequelPro
> str = 'utf8..... your string here...'
> puts str
utf8: "\xE2\x9C\x93"
id: "805265"
plan: initial
acc: "123456"
last: "1234"
doc: "1281468479"
validation: field
commit: Accept
=> nil
> str.match(/^acc: "(\d+)"/).captures.first
=> "123456"
If I understood correctly, In PostgreSQL use split_part
See this EXAMPLE
create table star (param text);
insert into star values ('utf8: "\xE2\x9C\x93"'),
('id: "805265"'),
('plan: initial'),
('acc: "123456"'),
('last: "1234"'),
('doc: "1281468479"'),
('validation: field'),
('commit: Accept');
and use function split_part in SELECT query to get value of acc: like this
select col2
from (
select split_part(param, ' ', 1) col1,
split_part(param, ' ', 2) col2
from star
) t where col1='acc:'
Note: if you want to split your field by : then use select split_part(param, ':', 1) and split_part(param, ':', 2) col2 so the WHERE clause should be where col1='acc'