Search

Showing posts sorted by relevance for query Regular Expression | Regex. Sort by date Show all posts
Showing posts sorted by relevance for query Regular Expression | Regex. Sort by date Show all posts

29 August, 2018

Python: Saving regular expression results in variables directly

Python Regular expressions has a powerful tools under it's regular expressions module which lets you create variables and save your search results directly.

It is called named groups . When you search for something and you want to save it in a variable when found, this is what you should use.

24 August, 2018

Regular Expressions: Look ahead and Look behind

Regular expressions are fun. There are two important concepts that are quite often sought for. Find something based on content that follows our search pattern . OR. Find something based on content that lies ahead. Let's see some examples to see what I mean.

LOOK AHEAD

LOOK AHEAD means , I want to see what lies ahead first, and then decide, to do something now.


Syntax of regex pattern:  pattern1(?=pattern2)


11 September, 2018

Regular Expressions. Lets not be greedy.

Recently faced a situation when I wanted to extracted parts of a html code. But then I realized, I have no control over the amount of information regex is giving me back.

10 May, 2019

Nose test command line tricks

If you are using nose plugin to run your tests , there are some handy tricks that we can use while running tests.

Run test and generate a XML report:


nosetests --with-xunit test_folder --xunit-file=nosetests_test_results.xml