Power Matching: Using Regular Expressions

When i started working with Apache JMeter, the documentation kept referencing something called Regular Expressions. In fact, I knew so little about this space that when a friend referred to Regular Expressions as “RegEx,” I wondered what he was talking about. Slowly i taught them to myself with the help of Wikipedia and a friend of mine. In this article, i will walk you through the basics of regular expression most commonly known as RegEx which plays a pivotal role in handling dynamic data in JMeter.

What are Regular Expressions, anyway?

Regular Expressions are a sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.  Regular Expressions are about “power matching.” Lets say if you want match the set containing the three strings “Handel“, “Händel“, and “Haendel” can be specified by the pattern H(ä|ae?)ndel; we say that this pattern matches each of the three strings. That is power matching using RegEx.

How do i learn about RegEx ?

Ultimately, understanding and writing Regular Expressions (RegEx) is a little bit like getting your first job. You can’t get hired without experience, and you can’t get experience without getting hired. With RegEx, you don’t really  understand them until you use them, and you can’t really use them until you understand them. So you have to learn a little bit, and then use a little bit and get them wrong, and then go back to the book and learn a little bit more. The other problem you will have with RegEx is that each character is easy. Put them all together and you get this:

/\?cid=[0-9]{3,3}

And that one wasn’t very hard. The more you work with them, the easier they’ll get.So master each step, put a couple together, make some mistakes and get going. Soon you’ll be a RegEx pro.

The Backslash(\)

I always encourage people to start their “RegEx career” by learning the characters, and the best one to start with is the backslash. A backslash is different from all the other characters, as you will see. It provides a bridge between Regular Expressions and plain text. A backslash “escapes” a character. What does “escape” mean? It means that it turns a Regular Expression character into plain text. If that doesn’t make sense to you yet, hold on – I have a few examples coming.

Continue reading Power Matching: Using Regular Expressions

Advertisements

Hypertext Transfer Protocol

What is an Internet Protocol?


An Internet protocol is a standard defined for addressing hosts and for routing datagram’s or packets between source host to destination host across one or more networks such as LAN, Internet and Intranet etc. Each protocol has its own rules such as to connect to hosts, how data is formatted, how the data is compressed during routing, how to check for errors in data etc. Many protocols are available in the World Wide Web. But most widely used protocols are few such as HTTP/HTTPS, FTP, TCP/IP, UDP, SMTP etc.

 Hypertext Transfer Protocol


  • Hypertext transfer protocol is an application layer protocol used for communicating between distributed systems.
  • HTTP protocol is built on top of TCP/IP communication protocol which is used to route “resources” on to World Wide Web. A resource is some chunk of information that can be identified by a URL (it’s the R in URL). The most common kind of resource is a file, but a resource may also be a dynamically-generated query result, the output of a CGI script, a document that is available in several languages, or something else.
  • HTTP protocol is a generic and stateless protocol.

Continue reading Hypertext Transfer Protocol