ByteScout Premium Suite - C# - Find US Address in PDF with Regex with PDF Extractor SDK - ByteScout

ByteScout Premium Suite – C# – Find US Address in PDF with Regex with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – C# – Find US Address in PDF with Regex with PDF Extractor SDK

How to find US address in PDF with regex with PDF extractor SDK in C# and ByteScout Premium Suite

Learn to code in C# to find US address in PDF with regex with PDF extractor SDK with this step-by-step tutorial

An easy to understand guide on how to find US address in PDF with regex with PDF extractor SDK in C# with this source code sample. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can be applied to find US address in PDF with regex with PDF extractor SDK using C#.

Want to quickly learn? This fast application programming interfaces of ByteScout Premium Suite for C# plus the guidelines and the code below will help you quickly learn how to find US address in PDF with regex with PDF extractor SDK. Follow the instructions from scratch to work and copy the C# code. This basic programming language sample code for C# will do the whole work for you to find US address in PDF with regex with PDF extractor SDK.

ByteScout Premium Suite free trial version is available on our website. C# and other programming languages are supported.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using Bytescout.PDFExtractor; using System; namespace FindUsAddressRegex { class Program { static void Main(string[] args) { try { // Create Bytescout.PDFExtractor.TextExtractor instance using (TextExtractor extractor = new TextExtractor()) { extractor.RegistrationName = "demo"; extractor.RegistrationKey = "demo"; // Load sample PDF document extractor.LoadDocumentFromFile("samplePDF_Address.pdf"); extractor.RegexSearch = true; // Enable the regular expressions int pageCount = extractor.GetPageCount(); // Search through pages for (int i = 0; i < pageCount; i++) { // Search Address string regexPattern = @"((\w+[ ,])+ ){2}([a-zA-Z]){2}[ , ] (\d+)"; // See the complete regular expressions reference at https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx // Search each page for the pattern if (extractor.Find(i, regexPattern, false)) { do { // Iterate through each element in the found text foreach (ISearchResultElement element in extractor.FoundText.Elements) { Console.WriteLine("Found Address: " + element.Text); } } while (extractor.FindNext()); } } } } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } Console.WriteLine(); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next