Study guide
6.1 Regular Expressions & Text Parsing for Automation
UiPath Automation Developer Professional UiPath-ADPv1
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Exam Overview & Blueprint Map
1.1 About the UiPath-ADPv1 Exam: Format, Fees & Policies 1.2 The Exam Topics Mapped to This Guide & a Study Plan
2 Chapter 2: REFramework Architecture & State Dynamics
2.1 State Machine Architecture & The Four Core States 2.2 Configuration Management: Settings, Constants, and Assets 2.3 Transaction Types & The Dispatcher vs. Performer Architecture 2.4 Adapting REFramework: Tabular Data, Collections & Linear Processes
3 Chapter 3: REFramework Exception Handling & Recovery
3.1 BusinessRuleException vs. System.Exception Handling Patterns 3.2 Retry Mechanisms: Queue Retries vs. REFramework MaxRetryNumber 3.3 Consecutive System Exceptions & Graceful Process Termination
4 Chapter 4: State Machines, Custom Log Fields & REFramework Testing
4.1 Building State Machine Projects in Studio 4.2 Logging Levels, Robot Logs & Custom Log Fields in REFramework 4.3 Testing a REFramework Project With and Without Orchestrator Queues
5 Chapter 5: LINQ Queries & DataTable Operations
5.1 LINQ Essentials for Collections & Filtering 5.2 Advanced DataTable Querying with LINQ 5.3 In-Memory DataTable Transformations & Column Operations
6 Chapter 6: Regex, DateTime, JSON & Invoke Activities
6.1 Regular Expressions & Text Parsing for Automation 6.2 DateTime Formatting, Timezone Conversions & TimeSpan Calculations 6.3 JSON Parsing, JSONPath & Serialization with Newtonsoft.Json 6.4 Invoke Method & Invoke Code Activities 6.5 Data Referencing in Invokes: DataTable, List & Dictionary Arguments
7 Chapter 7: Modern UI Automation & Unified Targeting
7.1 Modern Design Experience & The Unified Target Concept 7.2 Anchors, Relative Elements & UI Automation Activities 7.3 Dynamic Selectors, Variables & Wildcards in Selectors
8 Chapter 8: Object Repository, Computer Vision & Remote Runtime
8.1 Object Repository & UI Descriptor Libraries 8.2 AI Computer Vision for Unattended & Remote Interfaces 8.3 Automation in Virtual Environments & UiPath Remote Runtime
9 Chapter 9: Advanced UI Automation: Browser Modes, Agentic UI & macOS
9.1 Browser Automation with the WebDriver Protocol 9.2 Agentic UI Automation: ScreenPlay, Semantic Activities & Healing Agent 9.3 macOS Automation: Native Apps, Office Apps & AppleScript
10 Chapter 10: Advanced Control Flow & Exception Architecture
10.1 Flowcharts, Sequences & Parallel Control Flow Patterns 10.2 Global Exception Handler Architecture & ErrorAction Directives 10.3 TryCatch, Retry Scope & Custom Exception Architectures
11 Chapter 11: Orchestrator Queues & Transaction Management
11.1 Queue Architecture, SpecificContent & Transaction Lifecycles 11.2 Queue Items SLA, Postpone, Deadlines & Priority Scheduling 11.3 Bulk Operations, Transaction Status Updates & Queue Triggers
12 Chapter 12: Orchestrator Tenant & Folder Entities
12.1 Asset Types, Per-Robot Assets & External Credential Stores 12.2 Modern Folder Hierarchy, User/Robot Assignment & Permissions 12.3 Storage Buckets, Webhooks & Environment Promotion 12.4 Orchestrator Tags: Labels, Properties & Governance
13 Chapter 13: Unattended Execution, API Triggers & Cloud Robots
13.1 Unattended Job Execution: Folders, Priorities, Background vs. Foreground & Runtimes 13.2 API Triggers: Starting Jobs from External Systems over HTTP 13.3 Serverless and Cloud VM Robots: Cloud-Hosted Execution Options
14 Chapter 14: Monitoring, Recording & Solutions Management
14.1 Orchestrator Monitoring, Trigger Alerts & Job Health 14.2 Job and Transaction Recording: Troubleshooting Faulted Unattended Jobs 14.3 Solutions Management: Packaging and Deploying Automations with Their Resources
15 Chapter 15: Debugging, Remote Debugging & Profiling
15.1 Studio Debugging Tools: Breakpoints, Panels & Execution Control 15.2 Remote Debugging: Remote Machine and Unattended Robot Connections 15.3 Profile Execution: Finding Performance Bottlenecks in Studio
16 Chapter 16: RPA Testing & Test Suite
16.1 UiPath Test Suite Overview, Test Cases & Given-When-Then Structure 16.2 Data-Driven Testing, Test Verification Activities & Mock Activities 16.3 CI/CD Pipelines with uipcli & Test Manager Traceability
17 Chapter 17: Long-Running Workflows, Action Center & Apps
17.1 Long-Running Workflows: Persistence, Suspend and Resume 17.2 Action Center & Human-in-the-Loop Orchestration 17.3 UiPath Apps: Action Apps, Automations & Integration Service
18 Chapter 18: Trigger-Based Attended Automation & Callouts
18.1 Trigger-Based Attended Automation: Forms, Triggers & Global Variables 18.2 Running Local Triggers & the Event Inspection Tool 18.3 Callouts & Forms for Attended Guidance
19 Chapter 19: UiPath Assistant & Robot Sessions
19.1 UiPath Assistant: Automations, Reminders, Widgets & Configuration 19.2 Robot Session (Picture in Picture): Child Session vs. Virtual Desktop
20 Chapter 20: Autopilot for Developers & Autopilot for Everyone
20.1 Autopilot for Developers: AI Assistance in Studio and Studio Web 20.2 Autopilot for Everyone: Chat, Automations & Clipboard AI
21 Chapter 21: API Automation & Integration Service
21.1 Integration Service: Connectors, Connections & Connector Activities 21.2 API Workflows in Studio Web 21.3 HTTP Requests: Web APIs, the Orchestrator API & Connector Requests 21.4 Connector Builder: Custom Integration Service Connectors 21.5 Integration Service Event Triggers: Connected and Disconnected 21.6 GenAI Activities: Generative AI Inside Workflows
22 Chapter 22: Data Service, Context Grounding & Coded Workflows
22.1 Data Fabric (Data Service) Entities: Modeling Business Data 22.2 Data Fabric Activities and the Platform Connector 22.3 Context Grounding: Retrieval-Augmented Generation with Company Data 22.4 Coded Automations: Structure, Arguments & Invoking Workflows 22.5 Coded Automation Services: Orchestrator, UI Automation, Microsoft 365 & Custom Services
23 Chapter 23: Integrated Scenario Practice
23.1 Integrated Scenario Practice: Designing an End-to-End Solution
6.1 Regular Expressions & Text Parsing for Automation
Key Takeaways Explain This Topic AI
System.Text.RegularExpressions.Regex offers Match, Matches, IsMatch, and Replace; a MatchCollection is zero-indexed and Groups(0) is always the whole match.
RegexOptions.Multiline changes only the ^ and $ anchors to work per line, while RegexOptions.Singleline changes only the dot so it also matches newlines; the two can be combined.
Lookarounds such as (?<=...) and (?=...) check context without including it in the match, and .NET supports variable-length lookbehinds.
Named groups such as (?<Name>...) keep extraction code stable when a pattern changes, unlike positional Groups(1) indexes.
Use String methods for fixed delimiters and regex for variable patterns; RegexOptions.Compiled helps only for heavily reused patterns.
Last updated: September 2026
6.1 Regular Expressions & Text Parsing for Automation
In enterprise robotic process automation (RPA), robots frequently process semi-structured and unstructured textual data—such as scanned PDF invoices, customer support emails, mainframe terminal dumps, and dynamic web tables. While visual automation activities interact with structured UI controls, backend data processing relies heavily on string parsing and pattern matching. In the .NET ecosystem underpinning UiPath Studio, the System.Text.RegularExpressions.Regex class provides industrial-grade text parsing capabilities.
Mastering regular expressions (Regex) and string manipulation methods is critical for passing the UiPath Automation Developer Professional exam and building enterprise-grade workflows. A robust regex pattern extracts target transaction identifiers, monetary balances, dates, and account numbers resiliently, even when document layouts shift or whitespace fluctuates. Conversely, an improperly designed pattern can trigger catastrophic backtracking, severe memory leaks, or unhandled exceptions in production.
1. Architectural Foundation: The .NET Regex Engine in UiPath
UiPath Studio exposes the Microsoft .NET regular expression engine via the System.Text.RegularExpressions namespace. Developers can utilize regular expressions through visual activities—such as Matches , IsMatch , and Replace —or directly within Assign activities using the static and instance methods of the Regex class.
Static vs. Instance Regex Methods
The Regex class provides both static methods (which automatically cache compiled patterns in an internal least-recently-used cache) and instance methods (which require instantiating a New Regex(pattern, options) object).
Method Return Type Description & Primary RPA Use Case
Regex.IsMatch(input, pattern, options) Boolean Evaluates whether the pattern exists within the input string. Ideal for conditional gateways, filter predicates in LINQ, and dispatch routing.
Regex.Match(input, pattern, options) Match Returns the first occurrence matching the pattern. Used for singular entity extraction such as an invoice number, purchase order, or tax ID.
Regex.Matches(input, pattern, options) MatchCollection Returns an enumerable collection of all non-overlapping matches. Essential for extracting multiple line items, email recipients, or tabular rows.
Regex.Replace(input, pattern, replacement, options) String Substitutes matching substrings with a replacement string or evaluator result. Used for text sanitization, PII masking, and whitespace normalization.
The Object Hierarchy: MatchCollection, Match, and GroupCollection
Understanding the hierarchical object model returned by the regex engine is essential for correct value extraction:
MatchCollection : A collection of Match objects implementing ICollection and IEnumerable . It is 0-indexed. Accessing matches(0) yields the first Match .
Match : Represents a single match result. Key properties include:
match.Success : Boolean indicating whether a match was successfully found.
match.Value : String containing the entire matched substring.
match.Index : Zero-based character position where the match began in the source string.
match.Length : Character length of the matched substring.
match.Groups : GroupCollection containing all captured sub-groups.
GroupCollection : Contains captured groups within the match.
match.Groups(0) always contains the entire match (equivalent to match.Value ).
match.Groups(1) contains the first parenthesized capture group.
match.Groups("GroupName") accesses a named capture group. ' Visual Basic .NET: Extracting an invoice number using Regex.Match
- Dim inputDoc As String = "Vendor: Acme Corp | INVOICE # INV-2026-9812 | Due: 10/15/2026"
- Dim invMatch As Match = Regex.Match(inputDoc, "INV-\d{4}-\d+", RegexOptions.IgnoreCase)
- If invMatch.Success Then
- Dim invoiceNumber As String = invMatch.Value ' Evaluates to "INV-2026-9812"
- Console.WriteLine(invoiceNumber)
- End If // C#: Extracting an invoice number using Regex.Match
- string inputDoc = "Vendor: Acme Corp | INVOICE # INV-2026-9812 | Due: 10/15/2026";
- Match invMatch = Regex.Match(inputDoc, @"INV-\d{4}-\d+", RegexOptions.IgnoreCase);
- if (invMatch.Success) {
- string invoiceNumber = invMatch.Value; // Evaluates to "INV-2026-9812"
- }
- 2. RegexOptions Modifiers & Engine Configuration
The behavior of the .NET regex engine is configured via the RegexOptions bitwise enumeration. Omitting these flags or misunderstanding their interactions is a frequent source of production bugs and exam traps.
RegexOptions Flag Value Architectural Effect Enterprise RPA Use Case
IgnoreCase 1 Enforces case-insensitive matching across uppercase and lowercase letters. Parsing human-entered text where headers fluctuate between "INVOICE", "Invoice", and "invoice".
Multiline 2 Changes the interpretation of ^ and $ from the start and end of the entire input string to the start and end of each individual line (delimited by \n ). Extracting key-value pairs formatted on individual lines in text reports.
Singleline 16 Changes the interpretation of the dot ( . ) character so that it matches every character, including the newline ( \n ) character. Extracting multi-line paragraph blocks, legal disclosures, or tables spanning multiple lines.
ExplicitCapture 4 Modifies the engine so that unnamed parentheses (...) do not capture; only explicitly named groups (?<name>...) are captured. High-throughput parsing where memory allocation for unnecessary capture groups must be eliminated.
Compiled 8 Compiles the regular expression to Microsoft Intermediate Language (MSIL) rather than interpreting it via the regex engine. Repetitive batch processing where the same regex is evaluated millions of times across a loop.
Warning
The Multiline vs. Singleline Trap: Despite their names, Multiline and Singleline are not opposites and can be combined!
Multiline affects only anchors: ^ matches beginning of line; $ matches end of line. It does not change dot ( . ) behavior.
Singleline affects only the dot: . matches any character including \n . It does not alter ^ or $ .
In UiPath Studio, flags are combined using bitwise OR ( Or in VB.NET, | in C#): ' VB.NET: Combining IgnoreCase and Multiline
Dim patternOptions As RegexOptions = RegexOptions.IgnoreCase Or RegexOptions.Multiline
Dim lineMatches As MatchCollection = Regex.Matches(rawDocument, "^PO\s*:\s*(?<poNum>\d+)", patternOptions) // C#: Combining IgnoreCase and Multiline
- RegexOptions patternOptions = RegexOptions.IgnoreCase | RegexOptions.Multiline;
- MatchCollection lineMatches = Regex.Matches(rawDocument, @"^PO\s*:\s*(?<poNum>\d+)", patternOptions);
- 3. Grouping Mechanics: Capturing, Non-Capturing, and Named Groups
Grouping constructs delimit sub-expressions within a regular expression, controlling both precedence and data extraction.
Positional Capturing Groups: (...)
By default, placing parentheses around a sub-expression creates an unnamed capture group. The regex engine allocates memory to store each captured substring, accessible by index on match.Groups :
match.Groups(0) : The complete string matched by the full pattern.
match.Groups(1) : The substring matched by the first open parenthesis.
match.Groups(2) : The substring matched by the second open parenthesis.
Architectural Hazard : Positional indexing is fragile. If a developer introduces a new set of parentheses into the pattern during maintenance, all subsequent numerical indices shift by one, breaking downstream variable assignments without raising compile errors.
Non-Capturing Groups: (?:...)
A non-capturing group allows developers to apply quantifiers, alternation, or grouping logic without creating a capture group: ' Non-capturing group for prefix alternation: (?:Invoice|Receipt|Bill)
- ' Capture group 1 extracts only the numeric digits: (\d+)
- Dim pattern As String = "(?:Invoice|Receipt|Bill)\s*#?\s*(\d+)"
- Dim m As Match = Regex.Match("Receipt # 88291", pattern)
- ' m.Groups(1).Value evaluates to "88291"
Non-capturing groups improve execution performance and reduce GC memory allocations because the regex engine skips sub-string allocation.
Named Capturing Groups: (?<GroupName>...)
Named capture groups assign a semantic identifier to captured sub-expressions using the syntax (?<name>pattern) or (?'name'pattern) . In UiPath workflows, named groups drastically enhance maintainability: ' VB.NET: Structured extraction using named capture groups
Dim emailBody As String = "Claimant: John Doe | Policy: POL-992381 | Claim Amount: $4,850.00"
Dim claimPattern As String = "Claimant:\s*(?<Name>[^|]+)\|\s*Policy:\s*(?<Policy>POL-\d+)\|\s*Claim Amount:\s*(?<Amount>\$[\d,.]+)"
Dim matchResult As Match = Regex.Match(emailBody, claimPattern)
- If matchResult.Success Then
- Dim claimantName As String = matchResult.Groups("Name").Value.Trim()
- Dim policyNumber As String = matchResult.Groups("Policy").Value.Trim()
- Dim claimAmount As String = matchResult.Groups("Amount").Value.Trim()
- ' Output: "John Doe", "POL-992381", "$4,850.00"
- End If
- 4. Zero-Width Assertions: Lookahead & Lookbehind
Zero-width assertions—commonly known as lookarounds —assert that a sub-pattern exists (or does not exist) without advancing the engine's character pointer or including the matched characters in the final result.
The Four Lookaround Assertions
Assertion Type Syntax Engine Direction Assertion Logic
Positive Lookahead (?=subpattern) Forwards Matches if subpattern succeeds immediately to the right.
Negative Lookahead (?!subpattern) Forwards Matches if subpattern does not match to the right.
Positive Lookbehind (?<=subpattern) Backwards Matches if subpattern succeeds immediately to the left.
Negative Lookbehind (?<!subpattern) Backwards Matches if subpattern does not match to the left.
The Power of Lookarounds in Enterprise RPA
Lookarounds eliminate the need to strip prefixes or suffixes after extraction. For instance, extracting monetary amounts from an invoice often requires isolating numbers that immediately follow a currency symbol: ' Extracting amount without the dollar sign
' Input: "Total Balance Due: $1,245.50 on completion"
' Pattern: (?<=\$)\d{1,3}(?:,\d{3})*(?:\.\d{2})?
Dim cleanAmount As String = Regex.Match(text, "(?<=\$)\d{1,3}(?:,\d{3})*(?:\.\d{2})?").Value
' cleanAmount is "1,245.50" directly, ready for CDbl() conversion!
Tip
.NET Regex Engine Advantage: In most programming runtimes (such as Python's standard re module or JavaScript), lookbehinds must have a fixed, predetermined length. However, the Microsoft .NET regex engine fully supports variable-length lookbehinds (e.g., (?<=Invoice\s*(?:No|Number)?[:\s]*) ). This gives UiPath developers immense parsing flexibility.
5. Enterprise RPA Regular Expression Catalog
The following table provides tested, production-grade regular expressions engineered for common transaction processing scenarios in UiPath:
Target Entity Production Regex Pattern Breakdown of Regex Mechanics
Invoice / PO Number (?i)(?<=(?:invoice|po|purchase\s+order)\s*(?:no\.?|num|#)?[:\s]*)[A-Z0-9\-_]{4,20} Case-insensitive positive lookbehind scanning for prefix variations, isolating an alphanumeric reference of 4 to 20 characters.
Email Address \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b Boundary-anchored RFC-compliant pattern capturing alphanumeric and allowed special characters before the @ , followed by domain and TLD.
US Currency / Amount (?<=\$)\d{1,3}(?:,\d{3})*(?:\.\d{2})? Positive lookbehind asserting preceding \$ , followed by standard comma-delimited thousands groups and an optional two-decimal cent group.
Universal Dates (ISO & US) \b(?:\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])|(?:0[1-9]|1[0-2])/(?:0[1-9]|[12]\d|3[01])/\d{4})\b Validates both ISO 8601 ( YYYY-MM-DD ) and standard US format ( MM/DD/YYYY ) with calendar-bounded month and day ranges.
Social Security Number \b(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}\b Validates standard XXX-XX-XXXX format while enforcing Social Security Administration rules against invalid initial numbers (000, 666, 900-999) and all-zero sub-segments.
US Phone Number (?:\+?1[-.\s]?)?\(?[2-9]\d{2}\)?[-.\s]?[2-9]\d{2}[-.\s]?\d{4}\b Handles optional international country code +1 , optional area code parentheses, and standard delimiters (hyphen, dot, space).
Federal Tax ID (EIN) \b\d{2}-\d{7}\b Standard 9-digit Employer Identification Number formatted as XX-XXXXXXX (valid prefixes can start with 0).
6. String Methods vs. Regular Expressions: Performance & Architecture
While regular expressions provide immense pattern matching power, deploying a regex engine for simple, fixed-delimiter text manipulation introduces unnecessary CPU and memory overhead. Professional developers choose the appropriate tool based on architectural constraints.
Core .NET String Manipulation Methods
For deterministic parsing, native System.String methods are the simplest and fastest tools:
.Split(delimiters, options) : Splits a string into an array based on character or string delimiters. Using StringSplitOptions.RemoveEmptyEntries strips redundant blank tokens.
.Substring(startIndex, length) : Slices a deterministic segment based on zero-indexed character offsets.
.IndexOf(value) / .LastIndexOf(value) : Locates the zero-based character index of a substring. Returns -1 if not found.
.Trim() / .TrimStart() / .TrimEnd() : Strips leading and trailing whitespace or designated characters.
.PadLeft(totalWidth, paddingChar) : Right-aligns a string by prepending padding characters (e.g., converting "45" to "000045" ).
String.Format("Pattern {0}", arg) & String Interpolation $"{arg}" : Constructs strings dynamically without multi-token string concatenation ( & or + ).
Performance Benchmark and Architectural Comparison
Architectural Dimension Native String Methods ( .Split , .IndexOf ) Static Regex.Match (Cached) Compiled Regex ( RegexOptions.Compiled )
Execution Speed Fastest for fixed delimiters Fast; the static methods cache recently used patterns Faster per match once compiled
Startup Cost None Small: the pattern is parsed once and cached Higher: the pattern is compiled to IL on first use
Pattern Flexibility Rigid (exact matches and delimiters only) High (quantifiers, groups, lookarounds) Same as static Regex
Primary Use Case Fixed CSV lines, known key-value splits Unstructured documents, emails, OCR output The same pattern evaluated many thousands of times in a loop
The RegexOptions.Compiled Tradeoff
When RegexOptions.Compiled is specified, .NET compiles the pattern into IL code instead of interpreting it.
Advantage : Each match runs faster, which pays off when one pattern is used a very large number of times.
Disadvantage : The first use takes longer because of the compilation step.
Rule of Thumb : In UiPath workflows, the static Regex.Match() and the Matches or Replace activities are right for typical transaction volumes. Consider RegexOptions.Compiled only for a pattern reused in a long batch loop, and measure with Profile Execution before and after.