Question: I have a URL `(https://example.com/myfile.txt)` of a file and I want to upload it to my bucket `(gs://my-sample-bucket)` on Google Cloud Storage. 

What I am currently doing is: 

1. Downloading the file to my system using the requests library.
2. Uploading that file to my bucket using python function.

Is there any way I can upload the file directly using the URL.

Answer: 
You could use a positive lookahead to check for either a number with a decimal place with up to 6 digits after it or a string of 12 digits) and then match up to 13 characters in total:

```
^(?=\d*\.\d{0,6}$|\d{1,12}$).{1,13}$

```

For this input, the 2nd and 5th values will match:

```
1234567890123
123456.789012
12345.6789012
1234567.890123
12345.67890

```

[Demo on regex101](https://regex101.com/r/vHdArC/3)
We could try using negative lookaheads:

```
^(?:(?!.*\.)(?!\d{13})|(?=.*\.)(?![0-9.]{14}))\d+(?:\.\d{1,6})?$

```

[Demo
----](https://regex101.com/r/GEMn0m/1)

Here is an explanation of the regex:

```
^(?:                        from the start of the string
    (?!.*\.)(?!\d{13})      assert that no more than 12 digits appear
                            (in the case of a number with NO decimal point)
    |                       or
    (?=.*\.)(?![0-9.]{14})) assert that no more than 13 digits/decimal point appears
                            (in the case of a number which HAS a decimal point)
    \d+                     then match one or more digits (whole number portion)
    (?:\.\d{1,6})?          followed by an optional decimal component (1 to 6 digits)
$                           end of the string

```