Questions tagged [string-parsing]

The action of retrieving data from a string

String parsing is the action of extracting or modifying data pieces from a string. For example, one might parse a string to remove all quotation marks or to find all items inside quotation marks.

970 questions
2
votes
3 answers

How do I replace a space with a new line?

How do I replace a space with a newline ("\n") in a string using C?
Tim Jonas
  • 228
  • 2
  • 16
2
votes
4 answers

How to parse values appear after the same string in python?

I have a input text like this (actual text file contains tons of garbage characters surrounding these 2 string too.) (random_garbage_char_here)**value=xxx**;(random_garbage_char_here)**value=yyy**;(random_garbage_char_here) I am trying to parse the…
weefwefwqg3
  • 961
  • 10
  • 23
2
votes
2 answers

Pythonic way to parse a number out of a string that has a postfix

Using Python 3. I have a string such as 128kb/s, 5mb/s, or something as simple as 42!. There's no space between the numeric characters and its postfix, so I can't just invoke int(text) directly. And I just want to capture the values of 128,5, and…
selbie
  • 100,020
  • 15
  • 103
  • 173
2
votes
2 answers

Parsing a fraction in a Django form

I'm using Django on the backend and jQuery on the front end. I would like to accept both fractions and whole numbers (like "1/2", "1 1/4" or "2", for ingredient quantities in a recipe.) I'm using a FloatField to store these values. What is the best…
kgodey
  • 43
  • 7
2
votes
0 answers

YAML-cpp null string parsing?

How do I get this code to parse "" as a string (or recognize it is not an acceptable string)? I am using this YAML-cpp library which I verified treats this as a NodeType::value() and not a NodeType::Null. std::string getFilepath() { YAML::Node…
Graeme Rock
  • 601
  • 5
  • 21
2
votes
3 answers

How can I check for a reoccurring pattern in a string without knowing the actual pattern?

For example, I have a string, "fbrtfuifigfbrt". I want to find whether a sequence of characters reoccurs in a string, but I don't know what that sequence of characters is. In this case , it is fbrt. I thought about breaking the string into a bunch…
ack
  • 1,181
  • 1
  • 17
  • 36
2
votes
2 answers

Remove specific word in comma seperate string in MS SQL

Here is my column looks like, named Sets. My Column: {C=Pass, D=Fail, E=Pass, F= Pass, G=Pass} {C=Pass, D=Fail, E=NoApplication} Expected {C=Pass, E=Pass, F= Pass, G=Pass} {C=Pass, E=NoApplication} I wish to delete the "Fail" in my…
wow5
  • 35
  • 4
2
votes
1 answer

String read and parsing performance with C# and Unity

Background First, I have a text file (CSV) with a few columns and hundred thousands of rows. The total file size is 10MB. I used resource with Unity so it loads as Text The related code is: TextAsset txtData = Resources.Load("data.csv") as…
Splash
  • 1,288
  • 2
  • 18
  • 36
2
votes
3 answers

Python parse string containing functions, lists and dicts

I'm trying to find way to parse string that can contain variable, function, list, or dict written in python syntax separated with ",". Whitespace should be usable anywhere, so split with "," when its not inside (), [] or {}. Example string:…
2
votes
5 answers

How to extract multi-digit numbers from a string?

Firstly, I know similar questions have been asked before but I believe my case is different. My input string is: (5,7) (1,6) (2,4) (10,14) (8,9) I wrote the following code for extraction into an array. main(){ char s[100]; int i=0,x,n=0; int…
Vivek Shankar
  • 770
  • 1
  • 15
  • 37
2
votes
0 answers

Parsing with MessageFormat: Is there a way to force greedy matching, or to require that the entire input be matched?

Or: is there a another utility capable of both formatting strings and parsing strings (using the same object!) that can achieve this? Suppose you have a directory full of audio files in .au format with names following the pattern country.code.XX.au.…
2
votes
4 answers

Keeping domain of Email but removing TLD

I am using python and I want to be able to keep the domain of the email but remove the 'com', or '.co.uk', or 'us', etc So basically if I have an email, say random@gmail.com. I want to have only @gmail left in string format, but I want to do this…
Kalimantan
  • 702
  • 1
  • 9
  • 28
2
votes
2 answers

Extracting required Variables from Event Log file using Python

sample first row of event log file ,here i have successfully extracted evrything apart from last key value pair which is…
2
votes
3 answers

Sorting the unique values from regex match in python

I am trying to parse a log file to extract email addresses. I am able to match the email and print it with the help of regular expressions. I noticed that there are a couple of duplicate emails in my log file. Can you help me in figuring out how I…
abhinav singh
  • 1,024
  • 1
  • 12
  • 34
2
votes
2 answers

How to make a vector of character strings using strsplit in R?

I have a block of text that I have scraped into R and is being read as one long character string. Example of block of text: [1] "abc \n 18:19 \n abc \n 7-9 \n abc \n" Summary of block of text: summary(text) Length Class Mode 1 …
Dre
  • 713
  • 1
  • 8
  • 27