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
3
votes
1 answer

Capture keyboard inputs without a textbox

I have a application that reads data from health cards and parse them for basic info like D.O.B., Health Card #, and names. Right now, I have a textbox that takes input from the card swiper and it works great, but I feel there could be a better…
Craig
  • 259
  • 1
  • 5
  • 14
3
votes
0 answers

Parse ODATA query uri into PHP array

I have a client calling my web service written in PHP. While calling it, the client application gives a little query string to it. I want to parse this string into an array. So with the given example query within an url, I have started doing…
Marco Klein
  • 683
  • 5
  • 19
3
votes
2 answers

MATLAB 2012 regular expression

I have a set of strings that I'd like to parse in MATLAB 2012 that all have the following format: string-int-int-int-int-string I'd like to pluck out the third integer (the rest are 'don't cares'), but I haven't used MATLAB in ages and need to…
user1205577
  • 2,388
  • 9
  • 35
  • 47
3
votes
2 answers

How to delete the first and last two characters from a text file using sed?

I have a text file like this abcdefg abcdefg abcdefg abcdefg How to delete the first and last two characters from each line with sed? I would like to get the output like this bcde bcde bcde bcde
Joel
  • 67
  • 1
  • 1
  • 5
3
votes
4 answers

preg_match array items in string?

Lets say I have an array of bad words: $badwords = array("one", "two", "three"); And random string: $string = "some variable text"; How to create this cycle: if (one or more items from the $badwords array is found in $string) echo "sorry bad word…
DadaB
  • 762
  • 4
  • 12
  • 29
2
votes
2 answers

Using Java remove unbalanced/unpartnered parenthesis

I want to remove all the "unpartnered" or unpaired parenthesises from a string. exampleStr = back-pay) zyzhk1219(17) zyzhk1329 zyzhk1595(15) zyzhk1988 zyzhk2004 zyzhk2131) jswioj((testsjkldf The expected "parenthesis balanced" string should…
Watt
  • 3,118
  • 14
  • 54
  • 85
2
votes
4 answers

C# Crashing if no input for string Array

I Have a string array with 5 values, i want the program to loop even though i don't enter a value for the arrays. If I split the arrays without inserting anything (pressing ..... (5 times "." to split the array) then it doesn't crash it will just…
Nicholas
  • 783
  • 2
  • 7
  • 25
2
votes
3 answers

Parse 2 numbers in C# divided by minus sign

I have to parse a string. It contains one or two numbers. It can has 3 froms. {number1}-{number2} {number1}- -{number2} The numbers can be negative. So for example: 100-200 means: number1 = 100, number2 = 200 -100 means: number1 = null, number2 =…
vinczemarton
  • 7,756
  • 6
  • 54
  • 86
2
votes
1 answer

mb_split parsing function not working with Japanese characters UTF-8 text?

I'm trying to parse utf-8 encoded text files uploaded via a multipart/form-data form. I have built a small .txt file where I have entered some tab delimited (meaningless) text in both latin and Japanese characters (I copy/pasted the Jpz characters…
JDelage
  • 13,036
  • 23
  • 78
  • 112
2
votes
1 answer

Parsing a particular string in Haskell

I'm using the parsec Haskell library. I want to parse strings of the following kind: [[v1]][[v2]] xyz[[v1]][[v2]] [[v1]]xyz[[v2]] etc. I'm interesting to collect only the values v1 and v2, and store these in a data structure. I tried with the…
kafka
  • 949
  • 12
  • 27
2
votes
6 answers

Want to find and remove word only from string using - PHP

I hav especific need of removing word from string, But I am having problem when that word has dot (.) character. Lets see here is the string and what I have tried so far? $result = 'Hello Ka Kashish.'; $result = preg_replace('/\bKa\b/i', '',…
user443355
2
votes
3 answers

Parsing non-standard JSON

Anyone know what type of JSON (if even that!) the following code is? I'm retrieving this from the HTML of a website. I'm trying to parse it in C# with a JSON parser, but I'm having to do lots of preparatory editing to format it as 'valid' JSON…
user971580
2
votes
1 answer

Is there a python standard function to parse a string into an argv list exactly like bash does, in Python?

Consider the following string: ./kmux.py -r 'messenger.* xx' If kmux.py is a python script, and the string above was given to bash as an argument, then sys.argv will be the following list: ["./kmux.py", "-r", "messenger.* xx"] Is there a standard…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
2
votes
2 answers

Regex match - Python - any amount of characters

Cannot find an example that looks like what I am looking for. I am trying to capture ASN numbers in an FAA Aeronautical NOTAM. Example Below: Example Text: 2019-AWP-7268-OE Regex Match…
2
votes
1 answer

Regular Expression to replace comma separated words with question marks

I want to replace the following strings: chrome, internet explorer, mozlla, opera or john, jack, jill, bill with ?, ?, ?, ? I need a regular expression for Java which can replace the above string. Find all words and replace with question…
Arun
  • 3,036
  • 3
  • 35
  • 57