Skip to content
Advertisement

Tag: pattern-matching

Extract IBAN from text with Python

I want to extract IBAN numbers from text with Python. The challenge here is, that the IBAN itself can be written in so many ways with spaces bewteen the numbers, that I find it difficult to translate this in a usefull regex pattern. I have written a demo version which tries to match all German and Austrian IBAN numbers from

Find for the maximum occurrences of a particular pattern appearing consecutively within a substring [Python] [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question Suppose I want to find a pattern AAGTC in a string AGTCAAGTCAAGTCAAGTCXYZSDAAGTCAAGTC and return the maximum times AAGTC occurs consecutively

How to search a string for a long list of patterns

I’m writing a tool to index a document. I have a long list of hundreds, perhaps thousands of fixed patterns. E.g. my index might look like {“cat training”:”p.27″, “cat handling”:”p.29″, “cat”:”p.15″, “dog training”:”p.62″, “dog”:”p.60″} and so on. Now I want to search my text (for the sake of argument, each paragraph is a single string) for all instances of any

Advertisement