Equivalent of Javascript "match" in python

Stephane

I have a method for extracting all the "words" from a string in javascript:

mystring.toLowerCase().match(/[a-z]+/g);

I'd like to convert that same logic (create an array of "words" from my string), but in python. How can I achieve that?

alex

Use findall(), which is similar to String.prototype.match().

import re
regex = r"[a-z]+"
matches = re.findall(regex, strToScan)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Python Pandas equivalent in JavaScript

From Dev

Is there a JavaScript equivalent to Python's for loops?

From Dev

What is the equivalent of python's _ in javascript?

From Dev

JavaScript equivalent of python string slicing

From Dev

Is there an equivalent of from tokenize import pseudoprog.match in Python 3?

From Dev

Does python have an equivalent to Javascript's 'btoa'

From Java

Is there a javascript equivalent for the python pass statement that does nothing?

From Dev

Is there a JavaScript equivalent of the Python pass statement that does nothing?

From Java

Splat operators in JavaScript, equivalent to *args and **kwargs in Python?

From Dev

Equivalent of Python's KeyError exception in JavaScript?

From Dev

javascript equivalent to python's dictionary.get

From Dev

Is there an equivalent to Python's all function in JavaScript or jQuery?

From Dev

Is there a javascript object equivalent to python's pop() on dicts?

From Dev

Equivalent of sys.exit() of Python in JavaScript

From Dev

Javascript equivalent to $.on

From Dev

Javascript += equivalent?

From Dev

How do I code the equivalent in JavaScript of "Application.Match" in VBA? - - for use in a numerical interpolation function

From Dev

How do I code the equivalent in JavaScript of "Application.Match" in VBA? - - for use in a numerical interpolation function

From Dev

Are & and <and> equivalent in python?

From Dev

What is the python equivalent of JavaScript's Array.prototype.some?

From Dev

What are Python's equivalent of Javascript's reduce(), map(), and filter()?

From Dev

Javascript equivalent to Clojure's "reductions" or python's itertools.accumulate

From Dev

Do JavaScript classes have a method equivalent to Python classes' __call__?

From Dev

JavaScript equivalent of Python's parameterised string.format() function

From Dev

Equivalent searching using "like" with "match()"

From Dev

preg_match equivalent in Swift

From Dev

Equivalent searching using "like" with "match()"

From Dev

jquery find() equivalent for javascript

From Dev

Javascript equivalent to RNGCryptoServiceProvider

Related Related

  1. 1

    Python Pandas equivalent in JavaScript

  2. 2

    Is there a JavaScript equivalent to Python's for loops?

  3. 3

    What is the equivalent of python's _ in javascript?

  4. 4

    JavaScript equivalent of python string slicing

  5. 5

    Is there an equivalent of from tokenize import pseudoprog.match in Python 3?

  6. 6

    Does python have an equivalent to Javascript's 'btoa'

  7. 7

    Is there a javascript equivalent for the python pass statement that does nothing?

  8. 8

    Is there a JavaScript equivalent of the Python pass statement that does nothing?

  9. 9

    Splat operators in JavaScript, equivalent to *args and **kwargs in Python?

  10. 10

    Equivalent of Python's KeyError exception in JavaScript?

  11. 11

    javascript equivalent to python's dictionary.get

  12. 12

    Is there an equivalent to Python's all function in JavaScript or jQuery?

  13. 13

    Is there a javascript object equivalent to python's pop() on dicts?

  14. 14

    Equivalent of sys.exit() of Python in JavaScript

  15. 15

    Javascript equivalent to $.on

  16. 16

    Javascript += equivalent?

  17. 17

    How do I code the equivalent in JavaScript of "Application.Match" in VBA? - - for use in a numerical interpolation function

  18. 18

    How do I code the equivalent in JavaScript of "Application.Match" in VBA? - - for use in a numerical interpolation function

  19. 19

    Are & and <and> equivalent in python?

  20. 20

    What is the python equivalent of JavaScript's Array.prototype.some?

  21. 21

    What are Python's equivalent of Javascript's reduce(), map(), and filter()?

  22. 22

    Javascript equivalent to Clojure's "reductions" or python's itertools.accumulate

  23. 23

    Do JavaScript classes have a method equivalent to Python classes' __call__?

  24. 24

    JavaScript equivalent of Python's parameterised string.format() function

  25. 25

    Equivalent searching using "like" with "match()"

  26. 26

    preg_match equivalent in Swift

  27. 27

    Equivalent searching using "like" with "match()"

  28. 28

    jquery find() equivalent for javascript

  29. 29

    Javascript equivalent to RNGCryptoServiceProvider

HotTag

Archive