Thursday, 19 July 2012

Regular Expression

Regular Expression


Following are some Basic terms of Regular Expression which we should be aware.

1. literal: It is Character(s) OR words which we want to search in regular expression.
For Example:
                we want to search "tutorial" in the "php-tutorial-php.blogspot.in".
                Here "tutorial" is literal.


2. Meta Character: It is special chacter(s) which have special meaning in Regular Expression.
For Example:
                *, ., /, \, ? and ^.


3. Target string: The string in which we want to search the string.
For Example:
                we want to search "tutorial" in the "php-tutorial-php.blogspot.in".
                Here "php-tutorial-php.blogspot.in" is target string.


4. Regular expression: The regex with which we find the string.
For Example:
                we want to search "tutorial" in the "php-tutorial-php.blogspot.in" with regex    /(tutorial)/
                Here "/(tutorial)/" is Regular Expression.





Following are the Regular Expression with matches tested for PHP only.


An Introduction of Regular Expression


In computing, a regular expression provides a concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common abbreviations for "regular expression" include regexp and regex.
The concept of regular expressions was first popularized by utilities provided by Unix distributions, in particular the editor ed and the filter grep.
Regular Expression  Matche
^A
"A" at the beginning of a line
A$
"A"  at the end of a line
A\^
"A^" anywhere on a line (slash for escape spec. mean of ^) 
\$A
"$A" anywhere on a line
^\^
"^" at the beginning of a line
\$$
"$" at the end of a line
[0]
The character "0"
[0-9]
Any number
[^0-9]
Any character other than a number
[-0-9]
Any number or  "-"
[0-9-]
Any number or  "-"
[^-0-9]
Any character except a number or  "-"
[0-9]\]
Any number followed by a "]"
[0-9-z]
Any number, or any character between 0-9  and "z"
[0-9\-a\]\]
Any number, or - or a
\*
Any line with an asterisk
\\
Any line with a backslash
^\*
Any line starting with an asterisk
^A\*
Any line starting with an "A*"
^AA\*
Any line if it starts with one "AA*"
^A(A)*B
Any line with one or more "A"'s followed by a "B"
e.g.
AB, AAB, AAAB, AAAB
^A{4,8}B
Any line starting with "A" having 4-8 char and followed by B
eg
AAAAB, AAAAAAB, AAAAAAB
^A{4,}B
Any line starting with "A" min 4 character and followed by B
^A{4}B
Any line starting with "AAAAB"
A{4,8}
Any line with "A{4,8}"



Sunday, 15 July 2012

What is Paypal


PayPal is a global e-commerce business allowing payments and money transfers to be made through the Internet. Online money transfers serve as electronic alternatives to paying with traditional paper methods, such as checks and money orders.

Originally, a PayPal account could be funded with an electronic debit from a bank account or by a credit card at the payer's choice. But some time in 2010 or early 2011, PayPal began to require a verified bank account after the account holder exceeded a predetermined spending limit. After that point, PayPal will attempt to take funds for a purchase from funding sources according to a specified funding hierarchy. If you set one of the funding sources as Primary, it will default to that, within that level of the hierarchy (for example, if your credit card ending in 4567 is set as the Primary over 1234, it will still attempt to pay money out of your PayPal balance, before it attempts to charge your credit card). The funding hierarchy is (1) a balance in the PayPal account; (2) a PayPal credit account, PayPal Extras, PayPal SmartConnect, PayPal Extras MasterCard or Bill Me Later (if selected as primary funding source) (It can bypass the Balance); (3) a verified bank account; (4) other funding sources, such as non-PayPal credit cards.