Composing and Using Regular Expressions

Composing and Using Regular Expressions

Name:

Course:

Professor:

University:

Regular expression

Regular expression is structures or patterns that are used to match the character combinations in strings. For example, in JavaScript, the regular expression is also objects that are used in codes transfer and storage. The patterns or the structures are used together with the Exec and Test methods of the regular expressions and moreover, with the Match, replace, search and split methods of the strings in performing the extended functions. They are used to carry out the task of pattern matching and the search and then replace functions on the text in the computer programs. There are various ways that the regular expressions may be used to make sure that the operations are streamlined and also useful.  The UNIX regular expressions examples like the simple string matching are a bit more basic that can exploit various patterns which can allow one to search for more than one string at a time as opposed to the multiple ones (McKeever, 2003).

The examples that show how regular expression works

  • Setting the regular expression mode through modifiers is possible. Just after the regular expression pattern is defined immediately after the appending character is done in Ruby. Moreover, a particular matching is used as the case intensive modifiers that can be converted to from one source to another (Townsend, Riz & Schaffer, 2004).

                     >string to match = ‘BACK to BASICS’

                  > regex = /back to bsics/i

                  =>/back to basics/i

                    > regex.match (string to match)

                    =><MatchData “BACK to BASICS”>  

  • Below is a function of the Regular expression that shows how to use it to demonstrate the validity of the zip code that is utilized in the entire process.

        The private space Validate Zip Button Click (object sender, System.EventArgs e)

                                String ZipRegex = @”^\d{5}$”;

            If (Regex.IsMatch (ZipTextBox.Text, ZipRegex) then,

             ResultLabel.Text = “ZIP is valid!”

  • The possibility of the repetition in the regression expression allows for checking of the repeated patterns. We can widely search for a recurrence through the random number of times. On the other hand, we can also check for the granular as the correct number of the repletion that we are looking for in the program.

                 >string to match = ‘The mavericks beat the spur by 21 in game two.’

            > regex.match (string to match)

             => <MachData “2”>

The shortcoming of the Regular expression

The system of have limited space in the memory and therefore cannot support the use of ginormous regexes. The Regexes system needs much larger space for it to perform its task efficiently throughout the process. Therefore, lack of enough space in Regular expression limits the performance of the ginormous. Moreover, due to lack of space, the speed of the system will be affected automatically. This is because space and speed of the system are directly related. Therefore, based on this the speed of the Regexes is impacted similarly.

The regular expression systems cannot be asked to provide or establish matching of anything that is recurrent or perhaps recursive. This is because of the insufficiency of the state that is appropriate to perform the task and therefore they are not necessary for such a situation in the whole process. The matching that is possible in the system of regular expression is the state that is not recurrent, and this is because of the possibility of being traced (Edelstein, Farchi, Nir, Ratsaby & Ur, 2002).

References

Edelstein, O., Farchi, E., Nir, Y., Ratsaby, G., & Ur, S. (2002). Multithreaded Java program test generation. IBM systems journal, 41(1), 111-125.

McKeever, S. (2003). Understanding Web content management systems: evolution, lifecycle and market. Industrial management & data systems, 103(9), 686-692.

Townsend, J. J., Riz, D., & Schaffer, D. (2004). Building portals, intranets, and corporate web sites using Microsoft servers. Addison-Wesley Professional.

All Rights Reserved, essaytalent.com
Disclaimer: