使用正则表达式从 SAP HANA 中的字符串中查找所有匹配项(十进制)
Find all matches (decimal) from string in SAP HANA with Regex
我需要从 SAP HANA 中的字符串中提取所有匹配的十进制数字
文字:LOREN IPSUM DOLOR SIT AMET 73,89 X 339,85 X 0,08 CBC70° 1000/2,5
和
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 1
我只从文本中提取 73,89。
和
\d(.*?)([\.\,]\d{1,3})+\d(.+?)([\,]\d{1,3})+\d(.*?)([\,]\d{1,3})
我将 3 个值一起提取:73,89 X 339,85 X 0,08
我需要提取它,但我做不到。
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 1 ==> 73,89
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 2 ==> 339,85
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 3 ==> 0,08
谢谢!
要按照所示示例获得 3 个捕获组,您可以尝试以下操作。
(?<=\s)(\d+(?:,\d+)?)\s+X\s+(\d+(?:,\d+)?)\s+X\s+(\d+(?:,\d+)?)
解释: 为以上添加详细解释。
(?<=\s) ##Checking look behind if spaces are present before next mentioned match.
(\d+(?:,\d+)?) ##Creating 1st capturing group to match digits and ,digits as optional.
\s+X\s+ ##Matching spaces(1 or more occurrences) X spaces(1 or more occurrences).
(\d+(?:,\d+)?) ##Creating 2nd capturing group to match digits and ,digits as optional.
\s+X\s+ ##Matching spaces(1 or more occurrences) X spaces(1 or more occurrences).
(\d+(?:,\d+)?) ##Creating 3rd capturing group to match digits and ,digits as optional.
我需要从 SAP HANA 中的字符串中提取所有匹配的十进制数字
文字:LOREN IPSUM DOLOR SIT AMET 73,89 X 339,85 X 0,08 CBC70° 1000/2,5
和
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 1
我只从文本中提取 73,89。
和
\d(.*?)([\.\,]\d{1,3})+\d(.+?)([\,]\d{1,3})+\d(.*?)([\,]\d{1,3})
我将 3 个值一起提取:73,89 X 339,85 X 0,08
我需要提取它,但我做不到。
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 1 ==> 73,89
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 2 ==> 339,85
substr_regexpr('(\d(.*?)([\.\,]\d{1,3}))' in "Field" group 3 ==> 0,08
谢谢!
要按照所示示例获得 3 个捕获组,您可以尝试以下操作。
(?<=\s)(\d+(?:,\d+)?)\s+X\s+(\d+(?:,\d+)?)\s+X\s+(\d+(?:,\d+)?)
解释: 为以上添加详细解释。
(?<=\s) ##Checking look behind if spaces are present before next mentioned match.
(\d+(?:,\d+)?) ##Creating 1st capturing group to match digits and ,digits as optional.
\s+X\s+ ##Matching spaces(1 or more occurrences) X spaces(1 or more occurrences).
(\d+(?:,\d+)?) ##Creating 2nd capturing group to match digits and ,digits as optional.
\s+X\s+ ##Matching spaces(1 or more occurrences) X spaces(1 or more occurrences).
(\d+(?:,\d+)?) ##Creating 3rd capturing group to match digits and ,digits as optional.