Phone

org.llm4s.agent.guardrails.patterns.PIIPatterns.PIIType.Phone
case object Phone extends PIIType

Phone numbers: US formats ((XXX) XXX-XXXX, XXX-XXX-XXXX, XXX.XXX.XXXX, with an optional +1 or 1 prefix) and international numbers written with a leading +: the country code and the rest, 8 to 15 digits in all (the E.164 maximum), with spaces, dashes, dots or parentheses between digits (+44 20 7946 0958, +44 (0) 20 7946 0958, +81 3-1234-5678).

An international number needs its +: a plain run of digits is not treated as a phone number unless it has the US shape. A + followed by more than 15 contiguous digits is not matched. With separators, a match ends after at most 15 digits and leaves the rest: +44 20 7946 0958 1234 masks +44 20 7946 0958 and keeps 1234.

A + right after UTC or GMT, with or without a space between (UTC+5, GMT +1, any case), is a time-zone offset, not the start of an international number, so UTC+5 2026-10-09 12:30 is left alone.

Attributes

Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait PIIType
class Object
trait Matchable
class Any
Show all
Self type
Phone.type

Members list

Type members

Inherited types

type MirroredElemLabels = EmptyTuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Singleton
type MirroredElemTypes = EmptyTuple

Attributes

Inherited from:
Singleton
type MirroredMonoType = Singleton.this.type

The mirrored *-type

The mirrored *-type

Attributes

Inherited from:
Singleton
type MirroredType = Singleton.this.type

Attributes

Inherited from:
Singleton

Inherited and Abstract types

type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def mask(value: String): String

Inherited methods

def findAll(text: String): Seq[PIIMatch]

Find all matches of this PII type in text.

Find all matches of this PII type in text.

Attributes

Inherited from:
PIIType
def fromProduct(p: Product): MirroredMonoType

Create a new instance of type T with elements taken from product p.

Create a new instance of type T with elements taken from product p.

Attributes

Inherited from:
Singleton
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

val name: String
val pattern: Regex