Jump to content
xisto Community

TonyMccallum

Members
  • Content Count

    12
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by TonyMccallum


  1. Hello Guys,

     

    The .NET System.Text.RegularExpressions tools do not use /-delimited strings for regular expressions. Save that for javascript. Remove the leading / and the trailing /mg.

     

    Also, the group (.*?) does not make sense. .* is already "optional in that the * allows 0 occurances of the . to match. Remove the ?.

     

    Do you really want to match an empty string here? If not, use (.+) instead.

     

    When you type this into a C# literal, use @-quoting rather than regular C/C++ style quoting. The leading @ avoids all processing of \ escapes. To get a quote in the string, type a double quote. For example:

     

    string pattern = @"^a href=""(.*)"" class=I";

     

    For your tester, just type the string contents: <a href="(.*)" class=I>, without the <> brackets shown here.

     

    Thanks and Regards

    Tony Mccallum

     

    Mac Notebook


  2. Hi Guys,

     

    1. Open the IDLE text editor that comes bundled with the Python language by clicking on its icon. The IDLE text editor icon is located in the Python directory in your installed programs list (located under All Programs in the Windows Start Menu, and within the Applications folder in OSX). A blank source code file opens in the main editor window.

     

    2. Include the 're' module by writing this line at the top of the source code file: import re

     

    3. Declare a string and assign some email addresses to it, such as this: emailAddresses = 'William@amail.com, John@bmail.com, Bruce@cmail.com

     

    4. Create a regular expression that searches for all possible text permutations in valid email addresses. Regular expressions work by searching for a pattern of characters in a string of text. The pattern you are interested in is any two words joined by an @ symbol. Since email addresses have many valid characters, you want to match all possible characters in each word before and after the @ symbol. This is accomplished with the regular expression [\w\.-], and by adding a + to the end of it, you can repeat this for all the characters. The completed regular expression can be saved to a string like this: regexPattern = r'([\w\.-]+)@([\w\.-]+)'

     

    5. Create a regular expression that replaces all of the domain names with "zmail.com." In this regular expression, the backreference character sequence \1 is used to replace the domain of the email addresses. The backreference refers to a location in a regular expression surrounded in parenthesis. By applying the regular expression to the first backreference, you save the email address but discard the old domain name. You can then add a new domain name, like '@zmail.com.' To save this second regular expression to a variable, you can write this: regexReplacement = r'\1@zmail.com'

     

    6. Apply the regular expressions to the string containing the email addresses like this: emailAddresses = re.sub

     

    7. Print out the email addresses using this line of code. Python 3 uses this syntax for printing: print, while Python 2 uses this syntax: print emailAddresses.

     

    8. Run the program by pressing the F5 key. The program output is: William@zmail.com, John@zmail.com, Bruce@zmail.com

     

    Thanks and Regards

    Tony Mccallum


  3. Hello Friends,

     

    Regular expressions use special characters, or metacharacters, to describe possible combinations of text in strings. For example, you could create a regular expression that matches all strings that begin with the letter "d" and end with the file extension ".avi." You can use regular expressions with a security appliance device, intrusion protection system or other filtering proxy to block incoming or outgoing website URLs according to conditions that you specify.

     

    1. Determine which type of website or file URL that you want to block. Some network administrators block EXE and BIN files in order to keep unwanted programs from installing on machines in the network. You can also choose to block any page from a site domain such as social networking or file sharing site.

     

    2. Organize your regular expression(s) using metacharacters. Metacharacters provide instructions on how to sort the letters in the URL string. The "." serves as a replacement for a single character; "c.t" will match "cat," "cut" and "cot" or any string containing "c_t" such as "acute."

     

    The "|" operates as a logical "or" and parenthesis separate a substring from the rest of the regular expression. The "*" after a character or substring means that a string containing zero or more instances of the section will match while a question mark indicates that a string with zero or one case of the given substring will match.

     

    Use square brackets to denote a set of acceptable characters; [a-z] matches any lowercase letter. The "^" is used to show the start of a line.

     

    3. Create your final regular expression. The regular expression ".youtube.com" will block any YouTube website address. The regular expression ".*.([Dd][Oo][Cc]|[Xx][Ll][ss]|[Pp][Pp][Tt])" will block any website address ending with ".doc," ".xls" or ".ppt" and block the download or opening of these files from a web browser. The regular expression ".*.[bin|exe]" will block any Windows executables ending in ".bin" or ".exe." Use these regular expressions as a blueprint to create any regular expressions you need.

     

    4. Edit your settings to add a filtering rule for each regular expression. Procedures differ for each device or system but follow the same basic process. Cisco and H3C are two of the major manufacturers of intrusion protection systems. To add the regular expression to a Cisco device, click "Configuration" from the menu bar of the software, click "Firewall," then "Objects" then "Regular Expressions." Click "Add" on the right side of the pop-up box and enter a name for the regular expression rule and then the expression itself. Click "OK."

     

    For an H3C device, click "URL Filtering" in the navigation tree and click "URL Policies." Click "Add" and enter the name for the filtering rule. Click "User-Defined URL Rule" and click "Add." Select the "By regular expression" radio button under "Domain Name Filtering" or "URL Filtering." Enter the regular expression in the box and click "Apply." Click "Apply" again to save changes.

     

    Check the manufacturer's guide for your system to determine the exact process because it is different for each model, although it will likely follow the basic process that Cisco and H3C use.

     

    Thanks and Regards

    Tony Mccallum


  4. Hello Friends,Good question, there are free applications over the web which you can use in creating PDFs with security from distribution. I'm sorry, but I can't give you all of them. Just try typing "free pdf converter" in any search engines. My favorite is PrimoPDF. If you are using corel applications, you can convert it there too.Hope this helpsTony Mccallum


  5. Hello Friends,Greeting to all.My name is Tony Mccallum. I am a new member of this community. I have not found the introduction thread of this forum so, I am giving here my introduction. I am very much excited to join in this group. I came to your site with a lot of search. I want to know about different discussions on your site especially the discussion relating to Onenote Mac. I humbly request you to support and cooperate me in the discussion board. If any type of inconvenience, then I apologize for that.Thanks and RegardsTony Mccallum

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.