random alphanumeric string into hexadecimal in Python

I’m trying to turn an alphanumeric string into a hexadecimal number. The following code works as intended… A = "f8g9dsf9s7ff7s9dfg98d9fg97s06s6df5" B = int(A, 16) When I try create the alphanumeric dynamically it breaks and doesn’t get converted to hexadecimal number… A = ”.join(random.choices(string.ascii_lowercase + string.digits, k=34)) B = int(A, 16) Thanks for the help, extremely… Read More random alphanumeric string into hexadecimal in Python

Taking only letters out of string is not working in PHP

I have a database table which contains some application numbers. I want to take only letters out of its for example, I did the following: $post_content="BGCG0"; $only_text =preg_replace("/[^a-zA-Z0-9]+/", "", $post_content); echo $only_text; However it doesn’t do it. Can anyone please tell me how to accomplish this? >Solution : You’re allowing digits in your regex. Remove… Read More Taking only letters out of string is not working in PHP

regex extract all characters between a start and end string

I have strings that looks like this. setting-bs_b77f423715d2b991-node setting-bs_b77f423715d2b991-eggs setting-bs_b77f423715d2b991-cheese setting-bs_b14835f519bf447d-ham How do I extract just the middle element? e.g. bs_b14835f519bf447dit is always the same length and always has the same bs_ prefix. I unfortunately cannot use a lookbehind for this problem, as suggested in this answer as the regex must run inside bigquery which… Read More regex extract all characters between a start and end string

Regular expression to match pattern and text afterwards until that pattern occurs again, then repeat

I’m trying to write a regex for my Kotlin/JVM program that satisfies: Given this line of text {#FF00FF}test1{#112233}{placeholder} test2 It should match: Match 1: #FF00FF as group 1 and test1 as group 2 Match 2: #112233 as group 1 and {placeholder} test2 as group 2 #FF00FF can be any valid 6 character hex color code.… Read More Regular expression to match pattern and text afterwards until that pattern occurs again, then repeat

Identify pandas dataframe columns containing both numeric and string

I have created the following dataframe (called df): d = {‘ltv’: [1, 22,45,78], ‘age’: [33, 43,54,65],’job’: [‘Salaried’,’Salaried’,’Salaried’,’Owner’], ‘UniqueID’ : [‘A1′,’A2′,’A3′,’A4’] } df = pd.DataFrame(data=d) which looks like this: print(df) ltv age job UniqueID 1 33 Salaried A1 22 43 Salaried A2 45 54 Salaried A3 78 65 Owner A4 I have checked its columns types:… Read More Identify pandas dataframe columns containing both numeric and string

PowerQuery: Force Lowercase for an alphanumeric Text

How are you able to force an alphanumeric string to lowercase (or uppercase) in powerQuery? I have a series of attribute codes coming into powerQuery , but the codes contain variations of upper case and lower case text. In practice these items would be considered duplicates, but PowerQuery is case sensitive. I’ve tried using Text.lower… Read More PowerQuery: Force Lowercase for an alphanumeric Text