How to prevent the mysql regular expression'^ 'from querying the results?

problem description

Building main regular expression query

mysql> select ID,MJD,Scor_cfzhang from frb_info where  `MJD` REGEXP "^58025" and Scor_cfzhang != "null";
+----+-----------------------+--------------+
| ID | MJD                   | Scor_cfzhang |
+----+-----------------------+--------------+
|  2 | 58025.698382017348194 |          100 |
| 30 | 58025.699223994328349 |          100 |
| 31 | 58025.698048698614002 |           80 |
| 32 | 58025.698050328239333 |           60 |
| 33 | 58025.699217972105544 |           50 |
| 79 | 58025.698505595282768 |          100 |
| 80 | 58025.699104074352363 |          100 |
+----+-----------------------+--------------+

I used a regular expression on the field MJD, hoping to filter out the data that begins with 58025 MJD, such as the first table, which is indeed filtered out;

for the sake of demand, I deleted 58025 from the test. I thought I would not filter out any results, but there were still results, as follows:

mysql> select ID,MJD,Scor_cfzhang from frb_info where  `MJD` REGEXP "^" and Scor_cfzhang != "null"; +--------+-----------------------+--------------+
| ID     | MJD                   | Scor_cfzhang |
+--------+-----------------------+--------------+
|      2 | 58025.698382017348194 |          100 |
|     30 | 58025.699223994328349 |          100 |
|     31 | 58025.698048698614002 |           80 |
|     32 | 58025.698050328239333 |           60 |
|     33 | 58025.699217972105544 |           50 |
|     79 | 58025.698505595282768 |          100 |
|     80 | 58025.699104074352363 |          100 |
|  12649 | 58026.003595791531552 |           80 |
|  12654 | 58026.006771200598450 |           60 |
|  12678 | 58026.003670847967442 |           80 |
|  12679 | 58026.006788419123041 |          100 |
|  12680 | 58026.003669788704428 |           50 |
|  12703 | 58026.003668455377920 |           80 |
|  12706 | 58026.003597932278353 |           80 |
| 657138 | 58033.172940786324034 |          100 |
| 657144 | 58033.172941830765922 |           60 |
| 657148 | 58033.172941327058652 |           50 |
+--------+-----------------------+--------------+

so how do you query an empty result with a regular expression containing 58025?

Oct.31,2021

REGEXP'^ 58025' is a row that matches the beginning of 58025, and
REGEXP'^'is a row that matches the beginning, that is, all the data in your table. How can you think that you can't filter the results?

Menu