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
4
votes
3 answers

Finding phrase outside a delimited region

I'm writing regexes for log files to detect events. What I'm trying to do is detect if the phrase "restart-required" appears in the logs, but the tricky part is, I want to ignore all the debug messages. Unfortunately, the logs aren't deliminated in…
Rybon
  • 43
  • 4
4
votes
1 answer

Bulk update with associative array in PostgreSQL

Let's say I have an associative array (defined in another language) like so: apply = { 'qwer': ['tju', 'snf', 'rjtj', 'sadgg'] 'asdf': ['rtj', 'sfm', 'rtjt', 'adjdj'] ... 'zxcv': ['qwr', 'trj', '3w4u', '3tt3'] } And I have a table like…
user1005909
  • 1,825
  • 2
  • 17
  • 27
4
votes
3 answers

Python. Join specific lines on 1 line

Let's say I have this file: 1 17:02,111 Problem report related to router 2 17:05,223 Restarting the systems 3 18:02,444 Must erase hard disk now due to compromised data I want this output: 1 17:02,111 Problem report related to…
aDoN
  • 1,877
  • 4
  • 39
  • 55
4
votes
6 answers

Effective way of String splitting

I have a completed string like this N:Pay in Cash++RGI:40++R:200++T:Purchase++IP:N++IS:N++PD:PC++UCP:598.80++UPP:0.00++TCP:598.80++TPP:0.00++QE:1++QS:1++CPC:USD++PPC:Points++D:Y++E:Y++IFE:Y++AD:Y++IR:++MV:++CP:~~…
Posto
  • 7,362
  • 7
  • 44
  • 61
4
votes
5 answers

What's the best way to check if a character is a vowel in Java?

I'm trying to check if a certain char is a vowel. What's the best way to go about doing this?
Ky -
  • 30,724
  • 51
  • 192
  • 308
4
votes
3 answers

write text file mix between arabic and english

i'm trying to write in text file sentences that contains Arabic and English but the problem that both languages have direction RTL and LTR so the output text file don't save the order of the words and some words come before each other that is wrong,…
Mahmoud Ismail
  • 187
  • 1
  • 3
  • 12
4
votes
2 answers

Is there an inverse of Common Lisp's FORMAT?

I have a question that's been bothering me for some time. Is the Common Lisp format function reversible (at least to some degree) in that the format string could be used to retrieve original arguments from format's output? I am aware that the…
Wojciech Gac
  • 1,538
  • 1
  • 16
  • 30
4
votes
3 answers

Getting domain in AS3

I know how to get the URL of the page, but how can I extract simply the domain and the domain alone? It must return the same value with or without www, and it must also return the same value regardless of file, with or without trailing slash,…
Cyclone
  • 17,939
  • 45
  • 124
  • 193
4
votes
1 answer

Evaluate a Special Expression in C#

I have string which have a special substrings in a special format: $( variableName ) And this pattern can repeat nested many times: $( variableName $( anotherVariableName ) ) Such as: [ A test string ] Here is a test string contain $(variableA)…
Hippias Minor
  • 1,917
  • 2
  • 21
  • 46
4
votes
2 answers

Parsing and Regular Expression for Condional Logic String

I have to tokenize a conditional string expression : Aritmetic operators are = +, -, *, /, % Boolean operators are = &&, || Conditional Operators are = ==, >=, >, <, <=, <,!= An example expression is = (x+3>5*y)&&(z>=3 || k!=x) What i want is…
Hippias Minor
  • 1,917
  • 2
  • 21
  • 46
4
votes
1 answer

Why is sprintf returning false here?

I am trying to work out why sprintf is returning false here. Can anyone shed any light? sprintf( "select dog_name, date_format(meet_date, '%D %M %Y') as date, track_name, race_name, race_stakes, race_class, race_stakes, result_place, result_box,…
Nick Maroulis
  • 486
  • 9
  • 28
4
votes
2 answers

How to make a pyparsing grammar dependent on an instance attribute?

I’ve got a pyparsing issue that I have spent days trying to fix, with no luck. Here’s the relevant pseudocode: class Parser(object): def __init__(self): self.multilineCommands = [] self.grammar = # depends…
Zearin
  • 1,474
  • 2
  • 17
  • 36
4
votes
5 answers

How to Parse Dailymotion Video Url in javascript

I want to parse Dailymotion video url to get video id in javascript, like below: http://www.dailymotion.com/video/x44lvd video id: "x44lvd" i think i need regex string to get a video id for all dailymotion video url combinations. i found url parser…
relower
  • 1,293
  • 1
  • 10
  • 20
4
votes
1 answer

sscanf equivalent in Java

Possible Duplicate: what is the Java equivalent of sscanf for parsing values from a string using a known pattern? I'm pretty new to Java, but seeing how useful the sscanf function is, I wonder if there is an equivalent in Java. I've got many…
Dariusz G. Jagielski
  • 655
  • 3
  • 11
  • 22
3
votes
2 answers

Extracting relative paths from absolute paths

This is a seemingly simple problem but I am having trouble doing it in a clean manner. I have a file path as follows: /this/is/an/absolute/path/to/the/location/of/my/file What I need is to extract /of/my/file from the above given path since that is…
sc_ray
  • 7,803
  • 11
  • 63
  • 100