The regular expression in the documentation does not match the given example

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 文档中的正则表达式匹配不上给出的例子

| username: 有猫万事足

In this section, the regular expression

(?i)^(?:[^/]/)([a-z0-9_]+).([a-z0-9_]+)/(?:[^/]/)(?:[a-z0-9\-_.]+.(parquet))$

cannot match the given sample URL

S3://some-bucket/some-subdir/some-database/some-database.some-table/part-00000-c5a881bb-58ff-4ee6-1111-b41ecff340a3-c000.gz.parquet

The correct regular expression should be:

(?i)^(?:[^/]/)([a-z0-9\-_]+).([a-z0-9\-_]+)/(?:[^/]/)(?:[a-z0-9\-_.]+.(parquet))$

This way, it can match the database name and table name containing the (-) character.
Tests show that both the database name and table name can contain the (-) character.

After posting, I realized it might be a display issue. When quoted in comments, (\) is swallowed, and (\\) needs to be used for escaping. This might be why the originally correct regular expression became incorrect.

| username: Billmay表妹 | Original post link

Got it~ I’ll provide feedback~

| username: Billmay表妹 | Original post link

Relevant PR can be seen at: tidb-lightning: rename tables and databases by pepezzzz · Pull Request #15440 · pingcap/docs-cn · GitHub

| username: okenJiang | Original post link

Thank you for your feedback~. The (-) character can be included. If your database table name contains the (-) character, just add it directly.

| username: okenJiang | Original post link

May I ask, what database is used in the picture above, and which version of Aurora is it?

| username: 有猫万事足 | Original post link

The database used is TiDB 7.4.

| username: okenJiang | Original post link

Got it. Here, Aurora is just used as an example to explain this feature. Once you understand this feature, you can use it more flexibly and are not limited to the example. (-) It has already been added in the PR :blush:

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.