Repository: influxdata/influxdb-client-java (java)
Issue: How to use Flux(v6.9.0) to filter through fuzzy(Imprecise) queries(regular expression)?
__Proposal:__
Filter fuzzy(Imprecise) queries by tag or field.

__Current behavior:__
Finding that there is no imprecise filtering query method or regular expression filtering method, I tried using custom but he doesn't work as expected.

```
Flux flux = Flux
            .from("basic")
            .range(Instant.now(), Instant.now())
            .filter(Restrictions.and(
                    Restrictions.measurement().equal("api_log"),
                    Restrictions.tag("org_id").equal("EDUCLOUD"),
                    Restrictions.tag("title").custom("/account/", "=~"))
            .pivot(List.of("_time"), List.of("_field"), "_value")
            .group()
            .sort(List.of("_time"), true)
            .limit(10, (0 - 1) * 10);
```

anticipate:
```
from(bucket:"basic")
	|> range(start:2023-07-14T15:59:59.000000000Z, stop:2023-07-14T15:59:59.000000000Z)
	|> filter(fn: (r) => (r["_measurement"] == "api_log" and r["orgId"] == "EDUCLOUD" and r["title"] =~ /account/))
	|> pivot(rowKey:["_time"], columnKey:["_field"], valueColumn:"_value")
	|> group()
	|> sort(columns:["_time"], desc:true)
	|> limit(n:10, offset:0)
```
actual:
```
from(bucket:"basic")
	|> range(start:2023-07-14T15:59:59.000000000Z, stop:2023-07-14T15:59:59.000000000Z)
	|> filter(fn: (r) => (r["_measurement"] == "api_log" and r["orgId"] == "EDUCLOUD" and r["title"] =~ "/account/"))
	|> pivot(rowKey:["_time"], columnKey:["_field"], valueColumn:"_value")
	|> group()
	|> sort(columns:["_time"], desc:true)
	|> limit(n:10, offset:0)
```
error:
`com.influxdb.exceptions.InternalServerErrorException: HTTP status code: 500; Message: type error 3:88-3:109: string != regexp`
![image](https://github.com/influxdata/influxdb-client-java/assets/54580227/c6d72e4d-b298-4b2d-a4aa-689574dc5473)

__Desired behavior:__
Imprecise filter query method or regular expression filter method, custom filter regular expression is normal

__Alternatives considered:__
Restrictions.custom()  In the tank regular expression

__Use case:__
Regular expressions (regular expressions) are very powerful when matching patterns in large data collections, and they can effectively filter the amount of data.
Pull request description: fix: Issue/604
Closes #604 

can tested other repos because there are unwanted infrastructure dependency (why it needs to connect localhost:9999?)

## Proposed Changes
in flux-dsl, if ColumnRestriction has custom() function and it is using regular expression operator(such as "=~"), then it does not use double quotes.

## Checklist

<!-- Checkboxes below this note can be erased if not applicable to your Pull Request. -->

- [x] CHANGELOG.md updated
- [x] Rebased/mergeable
- [x] A test has been added if appropriate
- [x] `mvn test` completes successfully
- [x] Commit messages are [conventional](https://www.conventionalcommits.org/en/v1.0.0/)
- [x] Sign [CLA](https://www.influxdata.com/legal/cla/) (if not already signed)


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e087ce9bfc..a5812726e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 1. [#684](https://github.com/influxdata/influxdb-client-java/issues/684): Fix checking for CSV end of table marker when parsing CSV stream to InfluxQLQueryResult, needed for example when parsing the results of a query like "SHOW SERIES".
 2. [#662](https://github.com/influxdata/influxdb-client-java/issues/662): Adds to FluxDsl support for the `|> elapsed(unit)` function.
 3. [#623](https://github.com/influxdata/influxdb-client-java/issues/623): Enables the use of IPv6 addresses. 
+4. [#604](https://github.com/influxdata/influxdb-client-java/issues/604): Custom FluxDSL restrictions for regular expressions
 
 ### Dependencies
 
diff --git a/flux-dsl/src/main/java/com/influxdb/query/dsl/functions/restriction/ColumnRestriction.java b/flux-dsl/src/main/java/com/influxdb/query/dsl/functions/restriction/ColumnRestriction.java
index 05f27970f6..2daf791e22 100644
--- a/flux-dsl/src/main/java/com/influxdb/query/dsl/functions/restriction/ColumnRestriction.java
+++ b/flux-dsl/src/main/java/com/influxdb/query/dsl/functions/restriction/ColumnRestriction.java
@@ -192,7 +192,11 @@ public final class ColumnRestriction {
 
             String value;
             if (fieldValue instanceof String) {
-                value = "\"" + escapeDoubleQuotes((String) fieldValue) + "\"";
+                if (operator.contains("~")) {
+                    value = escapeDoubleQuotes((String) fieldValue);
+                } else {
+                    value = "\"" + escapeDoubleQuotes((String) fieldValue) + "\"";
+                }
             } else {
                 value = FunctionsParameters.serializeValue(fieldValue, false);
             }


Test patch:
diff --git a/flux-dsl/src/test/java/com/influxdb/query/dsl/functions/restriction/RestrictionsTest.java b/flux-dsl/src/test/java/com/influxdb/query/dsl/functions/restriction/RestrictionsTest.java
index 7a70053560..149416be1a 100644
--- a/flux-dsl/src/test/java/com/influxdb/query/dsl/functions/restriction/RestrictionsTest.java
+++ b/flux-dsl/src/test/java/com/influxdb/query/dsl/functions/restriction/RestrictionsTest.java
@@ -74,6 +74,17 @@ class RestrictionsTest {
         Assertions.assertThat(restrictions.toString()).isEqualTo("contains(value: r[\"_value\"], set:[\"value1\", \"value2\"])");
     }
 
+    @Test
+    void custom (){
+        Restrictions restrictions = Restrictions.value().custom("/.*target.*/", "=~");
+
+        Assertions.assertThat(restrictions.toString()).isEqualTo("r[\"_value\"] =~ /.*target.*/");
+
+        restrictions = Restrictions.value().custom("1", "==");
+
+        Assertions.assertThat(restrictions.toString()).isEqualTo("r[\"_value\"] == \"1\"");
+    }
+
     @Test
     void not() {