Модуль:Песочница/stannic/regexp/doc

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску

Это страница документации Модуль:Песочница/stannic/regexp.

[%d%s] and [%s%d] detect the same occurrences

'314159265'

  • string.match('314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '314159265'
  • string.match('314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '314159265'
  • mw.ustring.match('314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '314159265'
  • mw.ustring.match('314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '314159265'

'-314159265'

  • string.match('-314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-314159265'
  • string.match('-314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-314159265'
  • mw.ustring.match('-314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-314159265'
  • mw.ustring.match('-314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-314159265'

'- 314159265'

  • string.match('- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 314159265'
  • string.match('- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 314159265'
  • mw.ustring.match('- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 314159265'
  • mw.ustring.match('- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 314159265'

'  314159265   '

  • string.match('  314159265   ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '  314159265   '
  • string.match('  314159265   ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '  314159265   '
  • mw.ustring.match('  314159265   ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '  314159265   '
  • mw.ustring.match('  314159265   ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '  314159265   '

'314159265a'

  • string.match('314159265a', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('314159265a', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('314159265a', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('314159265a', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'a314159265'

  • string.match('a314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('a314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('a314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('a314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'3141a59265'

  • string.match('3141a59265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('3141a59265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('3141a59265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('3141a59265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'314-159265'

  • string.match('314-159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('314-159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('314-159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('314-159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'314159265-'

  • string.match('314159265-', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('314159265-', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('314159265-', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('314159265-', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'--314159265'

  • string.match('--314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('--314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('--314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('--314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'-- 314159265'

  • string.match('-- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('-- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('-- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('-- 314159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'-- 314 159 265'

  • string.match('-- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('-- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('-- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('-- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

'  -- 314 159 265  '

  • string.match('  -- 314 159 265  ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • string.match('  -- 314 159 265  ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil
  • mw.ustring.match('  -- 314 159 265  ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == nil
  • mw.ustring.match('  -- 314 159 265  ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == nil

[%d%s] and [%s%d] do not detect the same occurrences

'314 159265'

  • string.match('314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '314 159265'
  • string.match('314 159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '314 159265'
  • mw.ustring.match('314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '314 159265'
  • mw.ustring.match('314 159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '314 159265'

'-314 159265'

  • string.match('-314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-314 159265'
  • string.match('-314 159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-314 159265'
  • mw.ustring.match('-314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-314 159265'
  • mw.ustring.match('-314 159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-314 159265'

'- 314 159265'

  • string.match('- 314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 314 159265'
  • string.match('- 314 159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 314 159265'
  • mw.ustring.match('- 314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 314 159265'
  • mw.ustring.match('- 314 159265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 314 159265'

'314 159 265'

  • string.match('314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '314 159 265'
  • string.match('314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '314 159 265'
  • mw.ustring.match('314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '314 159 265'
  • mw.ustring.match('314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '314 159 265'

'-314 159 265'

  • string.match('-314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-314 159 265'
  • string.match('-314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-314 159 265'
  • mw.ustring.match('-314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-314 159 265'
  • mw.ustring.match('-314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-314 159 265'

'- 314 159 265'

  • string.match('- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 314 159 265'
  • string.match('- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 314 159 265'
  • mw.ustring.match('- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 314 159 265'
  • mw.ustring.match('- 314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 314 159 265'

'3 1 4 1 5 9 2 6 5'

  • string.match('3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '3 1 4 1 5 9 2 6 5'
  • string.match('3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '3 1 4 1 5 9 2 6 5'
  • mw.ustring.match('3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '3 1 4 1 5 9 2 6 5'
  • mw.ustring.match('3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '3 1 4 1 5 9 2 6 5'

'-3 1 4 1 5 9 2 6 5'

  • string.match('-3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-3 1 4 1 5 9 2 6 5'
  • string.match('-3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-3 1 4 1 5 9 2 6 5'
  • mw.ustring.match('-3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-3 1 4 1 5 9 2 6 5'
  • mw.ustring.match('-3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-3 1 4 1 5 9 2 6 5'

'- 3 1 4 1 5 9 2 6 5'

  • string.match('- 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 3 1 4 1 5 9 2 6 5'
  • string.match('- 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 3 1 4 1 5 9 2 6 5'
  • mw.ustring.match('- 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 3 1 4 1 5 9 2 6 5'
  • mw.ustring.match('- 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 3 1 4 1 5 9 2 6 5'

' 3 1 4 1 5 9 2 6 5'

  • string.match(' 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' 3 1 4 1 5 9 2 6 5'
  • string.match(' 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' 3 1 4 1 5 9 2 6 5'
  • mw.ustring.match(' 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' 3 1 4 1 5 9 2 6 5'
  • mw.ustring.match(' 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' 3 1 4 1 5 9 2 6 5'

' -3 1 4 1 5 9 2 6 5'

  • string.match(' -3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' -3 1 4 1 5 9 2 6 5'
  • string.match(' -3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' -3 1 4 1 5 9 2 6 5'
  • mw.ustring.match(' -3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' -3 1 4 1 5 9 2 6 5'
  • mw.ustring.match(' -3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' -3 1 4 1 5 9 2 6 5'

' - 3 1 4 1 5 9 2 6 5'

  • string.match(' - 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' - 3 1 4 1 5 9 2 6 5'
  • string.match(' - 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' - 3 1 4 1 5 9 2 6 5'
  • mw.ustring.match(' - 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' - 3 1 4 1 5 9 2 6 5'
  • mw.ustring.match(' - 3 1 4 1 5 9 2 6 5', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' - 3 1 4 1 5 9 2 6 5'

'3 1 4 1 5 9 2 6 5 '

  • string.match('3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '3 1 4 1 5 9 2 6 5 '
  • string.match('3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match('3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match('3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '3 1 4 1 5 9 2 6 5 '

'-3 1 4 1 5 9 2 6 5 '

  • string.match('-3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-3 1 4 1 5 9 2 6 5 '
  • string.match('-3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match('-3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '-3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match('-3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '-3 1 4 1 5 9 2 6 5 '

'- 3 1 4 1 5 9 2 6 5 '

  • string.match('- 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 3 1 4 1 5 9 2 6 5 '
  • string.match('- 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match('- 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == '- 3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match('- 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == '- 3 1 4 1 5 9 2 6 5 '

' 3 1 4 1 5 9 2 6 5 '

  • string.match(' 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' 3 1 4 1 5 9 2 6 5 '
  • string.match(' 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' 3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match(' 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' 3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match(' 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' 3 1 4 1 5 9 2 6 5 '

' -3 1 4 1 5 9 2 6 5 '

  • string.match(' -3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' -3 1 4 1 5 9 2 6 5 '
  • string.match(' -3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' -3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match(' -3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' -3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match(' -3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' -3 1 4 1 5 9 2 6 5 '

' - 3 1 4 1 5 9 2 6 5 '

  • string.match(' - 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' - 3 1 4 1 5 9 2 6 5 '
  • string.match(' - 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' - 3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match(' - 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%d%s]*$') == ' - 3 1 4 1 5 9 2 6 5 '
  • mw.ustring.match(' - 3 1 4 1 5 9 2 6 5 ', '^[%s]*[%-]?[%s]*[%d]+[%s%d]*$') == ' - 3 1 4 1 5 9 2 6 5 '

[%d ] (at least seems to be) equivalent to [ %d]

'314159265'

  • mw.ustring.match('314159265', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == '314159265'
  • mw.ustring.match('314159265', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == '314159265'

'314 159265'

  • mw.ustring.match('314 159265', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == '314 159265'
  • mw.ustring.match('314 159265', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == '314 159265'

'314 159 265'

  • mw.ustring.match('314 159 265', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == '314 159 265'
  • mw.ustring.match('314 159 265', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == '314 159 265'

'  314 159  265   '

  • mw.ustring.match('  314 159  265   ', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == '  314 159  265   '
  • mw.ustring.match('  314 159  265   ', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == '  314 159  265   '

'-314159265'

  • mw.ustring.match('-314159265', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == '-314159265'
  • mw.ustring.match('-314159265', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == '-314159265'

'  -   314 159  265    '

  • mw.ustring.match('  -   314 159  265    ', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == '  -   314 159  265    '
  • mw.ustring.match('  -   314 159  265    ', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == '  -   314 159  265    '

'  - -  314 159  265    '

  • mw.ustring.match('  - -  314 159  265    ', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == nil
  • mw.ustring.match('  - -  314 159  265    ', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == nil

'  314- 159  265   '

  • mw.ustring.match('  314- 159  265   ', '^[%s]*[%-]?[%s]*[%d]+[%d ]*$') == nil
  • mw.ustring.match('  314- 159  265   ', '^[%s]*[%-]?[%s]*[%d]+[ %d]*$') == nil


  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found
  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found
  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found
  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found
  • p1: string.match: not found, mw.ustring.match: not found
p2: string.match: not found, mw.ustring.match: not found
  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found
  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found
  • p1: string.match: found, mw.ustring.match: found
p2: string.match: found, mw.ustring.match: found