Monday, November 16, 2009

My favorite Regular Expression for deleting a line at a time

Ok, so you probably know the power of regular expressions or regex. One of the great things about regex is that with most modern text editors (and even some old classic ones) you can use them to do quick editing over a large file.

My favorite (and this will work in Visual Studio) is for removing lines at a time based on some match.

Let's say we want to select (most likely for removal) any line from a file that has the word Bart in it. Our regex would look like this:


The \n indicates new line. If you left off the \n the line would be selected without the new line character. If you are doing a replacement (such as with nothing to delete the line) and leave off the \n the line is selected but not the return character so for removing the text, a blank line would still exist in the file, whereas including the \n will delete the entire line from the file.


ukhelpdesknumber said...

All kind of Technical help and Support for your Dell Printer and is available with Epson Printer Support Number . Just give us a call 0800-098-8371 for Epson printer support number Uk.

juwai said...

This post is very usefull for me. A lots of thanks for sharing this informative post.

hp printer support

Antivirus Support Number UK 0800-090-3234 said...

Superb post. Many thanks for discussing valuable content material.
AVG Helpline Number UK
AVG Support Number UK

Technical Support UK 0800-090-3234,3242 said...

Very interesting post. Thank you for sharing..
Need help for kodak printer you can call with kodak Printer Support Number UK 0800-090-3234 in UK

Customer Help Number UK said...

Dell is the famous printer brand and its printers are widely used at each and every home and office. However, its printers show tech issues which you must get that resolved by technical experts of Dell Printer Support Number UK

Michael Thomas said...

Epson is the best printer manufacturer offering a wide range of printer at reasonable cost, but technical issues are the things that annoy the users. If you are also dealing with any tech issue, then you should talk to the technical experts.

Lillian Wilson said...

This research is practically done by you and gives good ideas. visit here some useful content here.
really useful information visit.
Epson Printer Support Number UK 0808-178-2624
Epson Printer Help Number UK
Epson Printer Contact Number UK

Lillian Wilson said...

Canon always brings best features and functions to maintain quality of their printers, Canon offers wide variety of printers for office as well as for home users. If you are planning to buy Canon printer, then you are free to contact us at Canon Printer Support Number UK 0808-178-2624.

Lillian Wilson said...

If you are facing the same problem with your HP printer then you are free to contact HP customer support team at 0808-178-2624HP Printer Customer Care Number UK .
Get More Details..

HP Printer Support Number UK 0808-178-2624

Michael Thomas said...

Getting complications in utilizing a Kodak Printer is common, but fixing that is not easy for everyone. When you get troubles in settling any issue of printer, then you should get in touch with the technical experts of Kodak Printer Contact Number UK. They will provide you accurate assistance in settling the issues.

Printersupportnumbers said...

Thank you for sharing this post.. I am waiting your next post..
We provide the best technical support for epson printer.. Get in touch with Epson Printer Support Number UK & Epson Printer Contact Number UK

Anonymous said...

Kodak is a trusted name known in the imaging product industry since long , it is known for its best quality products be it printer or be it cameras or anything else Kodak has always impressed its users in terms of technology but a machinery is made out of technology and therefore technical issues are unavoidable in order to get any technical issue so touch with us at Kodak Printer Support Number Uk

Jasmine Rose said...

Nice post helpful for those people. if you have technical problem in Avast antivirus. We are also providing services… Avast Contact Number UK | Avast Technical Support Number UK | Avast Help Desk Number UK | Norton Contact Number UK | AVG Help Number UK

kasperskyhelpnumber said...

I am glad to see a piece so well written with all the necessary details and information , keep posting more.
Kaspersky Contact Number & Kaspersky Support

Bullguard Support said...

All thanks to the writer for posting this here, the writer has very creatively added all the important points in this blog. Keep posting such pieces more often and get support Bullguard Toll Free Number UK & Bullguard help number UK

McAfee Help Number 44-800-041-8254 McAfee Support Number said...

Thanks for posting this informative content here, it helped me a lot and will surely a lot of other people as well.
McAfee Support Number UK
McAfee Contact Number UK

Unknown said...

I am very much surprised by the quality of the content written, this shows we have great writers sharing their knowledge over the internet and Get Instant Support for Gmail visit at Gmail Helpline Number Uk & Gmail Support Number Uk