Q:

Get key value of matching case insensitive string

I'm attempting to pull some specific data from the "id" field but jq matches are being case sensitive and creating an issue with the searches (not matching, basically, so returning 0 results).
JSON Example:
{
  "created_at": "2020-01-17T12:54:02Z",
  "primary": true,
  "verified": true,
  "deliverable_state": "deliverable",
  "undeliverable_count": 0,
  "updated_at": "2020-01-17T12:54:03Z",
  "url": "http://www.website.com",
  "id": 376062709553,
  "user_id": 374002305374,
  "type": "email",
  "value": "test-1234567@domain.com"
}
{
  "created_at": "2019-02-07T20:49:41Z",
  "primary": false,
  "verified": true,
  "deliverable_state": "deliverable",
  "undeliverable_count": 0,
  "updated_at": "2019-02-07T20:49:41Z",
  "url": "http://www.website.com",
  "id": 366235941554,
  "user_id": 374002305374,
  "type": "email",
  "value": "MyEmail@domain.com"
}

When running jq against the following, I get the correct return:
$ jq -r '. | select(.value=="MyEmail@domain.com") .id' sample.json
366235941554

But if I run with the incorrect case, eg.
$ jq -r '. | select(.value=="Myemail@domain.com") .id' sample.json

...I do not get a result.  I've read through some of the documentation but unfortunately, I do not understand the test/match/capture flags for insensitive search (https://stedolan.github.io/jq/manual/#RegularexpressionsPCRE) or how to get it to operate with this "locate and give me the value" request.
I've searched seemingly everywhere but I'm unable to find any examples of this being used.

A:

You don't really need regexp for this.
select(.value | ascii_downcase == "myemail@domain.com") .id

But if you insist on it, below is how you perform a case-insensitive match using test/2.
select(.value | test("MyEmail@domain.com"; "i")) .id

