Python:
import re
from math import sqrt
class Point:
def __init__(self,x_init,y_init):
self.x = x_init
self.y = y_init
def shift(self, x, y):
self.x += x
self.y += y
def __repr__(self):
return "".join(["Point(", str(self.x), ",", str(self.y), ")"])
def distance(a, b):
return sqrt((a.x-b.x)**2+(a.y-b.y)**2)
def pointRegex(str2Check: str) -> str:
theRegex: str = "[-+]?[0-9]{1,13}"
result: Point = Point(0,0)
m = re.search(theRegex, str2Check)
result.y = int(m.group(0))
# rought translation up to : String phase2 = str2Check.replace(result.y + "", "");
return m.group(0)