>>232

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
namespace ReadCredit
{
class Program
{
static void Main(string[] args)
{
string filename = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\syumatsu2019012500.pdf";
StringBuilder sb = new StringBuilder();
sb.AppendLine("記号,銘柄 種別,コード,新コード,売残計,前週比,貸残計,前週比,一般信用売,前週比,制度信用売,前週比,一般信用買,前週比,制度信用買,前週比");
using (PdfReader reader = new PdfReader(filename))
{
for (int i = 0; i < reader.NumberOfPages; i++)
{
string s = PdfTextExtractor.GetTextFromPage(reader, i + 1, new iTextSharp.text.pdf.parser.SimpleTextExtractionStrategy());
string[] lines = s.Split('\n');
foreach (string line in lines)
{
string pattern = "(?<kigou>\\w{1})\\s{0,1}(?<name>.*?)(?<code5>\\d{5})\\s{0,1}(?<code_jp>JP\\d{10})\\s{0,1}(?<data>.*?)$";
Match m = Regex.Match(line.Replace(",", ""), pattern);