itongxiaojun opened a new pull request, #3917:
URL: https://github.com/apache/ambari/pull/3917

   Error Message:
   re.error: global flags not at the start of the expression at position 3
   
   
![image](https://github.com/user-attachments/assets/a5762bb4-89ff-4e34-9eea-41cc4046790a)
   
   Issue:
   This error occurs specifically in Python 11 when using regular expressions 
with global flags. The problem is that in Python 11, the regex flag (?u) must 
be placed at the beginning of the regular expression pattern, not in the middle 
or end.
   File Location:
   
[ambari-common](https://issues.apache.org/jira/browse/AMBARI-common)/src/main/python/ambari_jinja2/ambari_jinja2/filters.py
   Solution:
   Change the regular expression pattern from:
   _word_re = re.compile(r"\w+(?u)")
   to:
   _word_re = re.compile(r"(?u)\w+")
   Explanation:
   ● The (?u) flag enables Unicode matching
   ● In Python 11, all flags must be specified at the start of the regular 
expression pattern
   ● This issue only appears in Python 11; earlier Python versions work fine 
with flags in any position
   ● Moving the (?u) flag to the beginning of the pattern resolves the error 
while maintaining the same functionality


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to